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

add: reading and matching ice stats (commented)

parent 7ce2666c
No related branches found
No related tags found
1 merge request!12Clhp map
......@@ -3,6 +3,7 @@ from datetime import datetime
import random
from random import randint
# get_markers requests all marker data or valid markers, converts the data to json, and writes
# the data to the response object
def get_all_markers(self, cursor, waterBodyName):
......@@ -28,10 +29,25 @@ def get_all_markers(self, cursor, waterBodyName):
# Container for all fetched measurement objects
measurement_data = {}
'''
f = open('server/?')
data = json.load(f)
'''
# Iterate over all fetched rows
for row in rows:
measurement_id = row[0]
'''
curr_stat = []
# Find matching ice stat
for stat in data['stats']
if ice_stats.sub_div_id == row[8]
curr_stat = stat
break
'''
# Create subdivision new object
sub_division = {
'SubdivID': row[8],
......@@ -109,6 +125,9 @@ def get_all_markers(self, cursor, waterBodyName):
test_measurements.append(measurement)
########################### TEST DATA ###########################################
# NB remember to clos file after implementation
# f.close()
# Convert dictionary values to list of measurements
data = list(measurement_data.values()) + test_measurements
......
import geopandas as gpd
from shapely.geometry import Polygon, MultiPolygon
import json
from server.map_handler.add_lake import write_json_to_file
# Writes contents of a map_handler json file to the response
......@@ -34,4 +31,4 @@ def get_ids_and_centers(file_name): # NB buggy
'sub_div_center': sub_div_center
}
subdivisions.append(subdivision)
return subdivisions
\ No newline at end of file
return subdivisions
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