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

refactor: server file and function names

parent 9f339462
No related branches found
No related tags found
1 merge request!10Clhp map
...@@ -40,6 +40,7 @@ class _ChoroplethMapState extends State<ChoroplethMap> { ...@@ -40,6 +40,7 @@ class _ChoroplethMapState extends State<ChoroplethMap> {
late MapShapeSource mapShapeSource; late MapShapeSource mapShapeSource;
late final MapZoomPanBehavior _zoomPanBehavior = MapZoomPanBehavior(); late final MapZoomPanBehavior _zoomPanBehavior = MapZoomPanBehavior();
List<SubDiv> subdivisions = <SubDiv>[]; List<SubDiv> subdivisions = <SubDiv>[];
List<SubDiv> groupDivisions = <SubDiv>[];
@override @override
void initState() { void initState() {
...@@ -51,6 +52,12 @@ class _ChoroplethMapState extends State<ChoroplethMap> { ...@@ -51,6 +52,12 @@ class _ChoroplethMapState extends State<ChoroplethMap> {
} }
}; };
// ?Should the map be pre-divided into groups?
// Parse relation to json
// Make a list of key value pairs (key: groupID, value: appended shapes)
// Parse back to Uint8list
// Initialise data source // Initialise data source
dataSource = MapShapeSource.memory( dataSource = MapShapeSource.memory(
widget.relation, widget.relation,
......
mjosa
\ No newline at end of file
This diff is collapsed.
from flask import Flask from flask import Flask
from http.server import HTTPServer, BaseHTTPRequestHandler from http.server import HTTPServer, BaseHTTPRequestHandler
from consts import SSL_CERT_PATH, SSL_KEY_PATH, HOST, PORT from consts import SSL_CERT_PATH, SSL_KEY_PATH, HOST, PORT
from map.get_markers import get_all_markers from map.get_measurements import get_all_markers
from map.get_relation import cut_map from map.add_lake import cut_map
from APIs.get_weather import get_weather from APIs.get_weather import get_weather
from map.input_new_data import input_new_Lidar_data from map.input_new_data import input_new_Lidar_data
import ssl import ssl
......
File deleted
File deleted
...@@ -11,7 +11,7 @@ import os ...@@ -11,7 +11,7 @@ import os
# Read a json file with relation data and send to response object # Read a json file with relation data and send to response object
def cut_map(self, body_of_water: str): # NB: implement body_of_water def cut_map(self, body_of_water: str): # NB: implement body_of_water
# Read relation from GeoJson file and extract all polygons # Read relation from GeoJson file and extract all polygons
geo_data = gpd.read_file("server/map/mjosa.geojson") geo_data = gpd.read_file("server/lake_relations/mjosa.geojson")
polygon_data = geo_data[geo_data['geometry'].geom_type == 'Polygon'] polygon_data = geo_data[geo_data['geometry'].geom_type == 'Polygon']
polygons = [Polygon(polygon.exterior) for polygon in polygon_data['geometry']] polygons = [Polygon(polygon.exterior) for polygon in polygon_data['geometry']]
...@@ -85,7 +85,7 @@ def cut_map(self, body_of_water: str): # NB: implement body_of_water ...@@ -85,7 +85,7 @@ def cut_map(self, body_of_water: str): # NB: implement body_of_water
'tile_count': sub_div_id, # Add the last subdivision ID as number of tiles 'tile_count': sub_div_id, # Add the last subdivision ID as number of tiles
} }
write_json_to_file("server/lake_relations", "mjosa", feature_collection) #write_json_to_file("server/lake_relations", "mjosa", feature_collection)
self.send_response(200) self.send_response(200)
self.send_header("Content-type", "application/json") self.send_header("Content-type", "application/json")
self.end_headers() self.end_headers()
...@@ -134,6 +134,7 @@ def combine_grid_with_poly(polygon, grid): ...@@ -134,6 +134,7 @@ def combine_grid_with_poly(polygon, grid):
def write_json_to_file(path: str, file_name: str, json_data: dict): def write_json_to_file(path: str, file_name: str, json_data: dict):
# NB add lake name to 'added_lakes.txt'
print("Writing to file...") print("Writing to file...")
if not os.path.exists(path): if not os.path.exists(path):
raise Exception("Directory from path does not exist") raise Exception("Directory from path does not exist")
......
File moved
This diff is collapsed.
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