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

update: round center coords of tiles to 4 decimals

parent 4311a3c3
No related branches found
No related tags found
1 merge request!7Clhp map
No preview for this file type
No preview for this file type
......@@ -6,9 +6,6 @@ import random
import json
import os
polygon_min_x = None # The left most point of the entire polygon
# Read a json file with relation data and send to response object
def get_relation(self, body_of_water: str): # NB: implement body_of_water
# Read relation from GeoJson file and extract all polygons
......@@ -40,22 +37,24 @@ 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:
for tile in tiles[45:60]: # 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')
plt.show()
##################### PLOTTIND END ###########################
features = []
sub_div_id = 0
for tile in divided_map:
for tile in divided_map[45:60]: # NB temporarily limited to 5 tiles
center = round(tile.centroid.coords[0][0], 4), round(tile.centroid.coords[0][1], 4)
tile_feature = {
'type': 'Feature',
'properties': {
'sub_div_id': sub_div_id,
'sub_div_center': tile.centroid.coords[0]
'sub_div_center': center
},
'geometry': tile.__geo_interface__
}
......
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