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

update: att cell size to new_lake endpoint

parent d26c38ee
No related branches found
No related tags found
1 merge request!14Clhp map
......@@ -100,7 +100,12 @@ class IceHTTP(BaseHTTPRequestHandler):
lake_name = query_params.get('lake', [None])[0]
if lake_name is not None:
cut_map(self, cursor, lake_name)
cell_size = query_params.get('cell_size', [''])[0]
if cell_size is not None:
cut_map(self, cursor, lake_name, cell_size)
else:
cut_map(self, cursor, lake_name)
else:
self.send_response(400)
self.send_header('Content-type', 'application/json')
......
......@@ -25,7 +25,7 @@ lng = (distance_in_km × 360)/(40075km × cos(lat))
# Read a json file with relation data and send to response object
def cut_map(self, cursor, lake_name: str):
def cut_map(self, cursor, lake_name: str, dist_in_km=0.5):
try:
# Read relation from GeoJson file and extract all polygons
geo_data = gpd.read_file(LAKE_RELATIONS_PATH + lake_name + ".geojson")
......@@ -37,7 +37,6 @@ def cut_map(self, cursor, lake_name: str):
divided_map = []
dist_in_km = 0.08 # NB placeholder
cell_size = dist_in_km * 10
cell_width = cell_size / 111.32
cell_height = (cell_size * 360) / (40075 * cos(cell_width))
......
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