Skip to content
Snippets Groups Projects
Commit a023e1af authored by Sara Savanovic Djordjevic's avatar Sara Savanovic Djordjevic
Browse files

update: tile center calculation

parent c85dfbde
No related branches found
No related tags found
2 merge requests!9Clhp map,!8Clhp map
......@@ -53,8 +53,11 @@ def cut_map(self, body_of_water: str): # NB: implement body_of_water
sub_div_id = 0
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)
# Calculate tile center based on bounds, and round down to two decimals
min_x, min_y, max_x, max_y = tile.bounds
center = round(max_x-min_x, 4), round(max_y-min_y, 4)
# center = round(tile.centroid.coords[0][0], 4), round(tile.centroid.coords[0][1], 4)
rounded_coordinates = []
if isinstance(tile, Polygon):
for coords in tile.exterior.coords:
......@@ -135,9 +138,7 @@ def write_json_to_file(path: str, file_name: str, json_data: dict):
json.dump(json_data, f)
'''
def get_divided_map(file_name):
geo_data = gpd.read_file("server/map/mjosa.geojson")
geo_data = gpd.read_file("server/map/" + file_name + ".geojson")
polygon_data = geo_data[geo_data['geometry'].geom_type == 'Polygon']
polygons = [Polygon(polygon.exterior) for polygon in polygon_data['geometry']]
'''
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment