diff --git a/server/map/get_relation.py b/server/map/get_relation.py index d930473dbcb17e015e0548230c6335767dc8a593..5a384e045cd8e56f24157fa4dc012ccef024e3a1 100644 --- a/server/map/get_relation.py +++ b/server/map/get_relation.py @@ -37,7 +37,7 @@ def get_relation(self, body_of_water: str): # NB: implement body_of_water ax.set_aspect(1.5) # Plot each tile - for tile in tiles[45:60]: # NB temporarily limited to 5 tiles + for tile in tiles: # NB temporarily limited to 5 tiles random_color = "#{:06x}".format(random.randint(0, 0xFFFFFF)) gpd.GeoSeries(tile.geometry).plot(ax=ax, facecolor=random_color, edgecolor='none') @@ -48,15 +48,16 @@ def get_relation(self, body_of_water: str): # NB: implement body_of_water features = [] sub_div_id = 0 - for tile in divided_map[45:60]: # NB temporarily limited to 5 tiles + for tile in divided_map: # NB temporarily limited to 5 tiles # Round coordinates to 4 decimals center = round(tile.centroid.coords[0][0], 4), round(tile.centroid.coords[0][1], 4) rounded_coordinates = [] - for coords in tile.exterior.coords: - rounded_coords = (round(coords[0], 4), round(coords[1], 4)) - rounded_coordinates.append(rounded_coords) - rounded_tile = Polygon(rounded_coordinates) + if isinstance(tile, Polygon): + for coords in tile.exterior.coords: + rounded_coords = (round(coords[0], 4), round(coords[1], 4)) + rounded_coordinates.append(rounded_coords) + rounded_tile = Polygon(rounded_coordinates) tile_feature = { 'type': 'Feature',