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

update: minor upates on shape selection

parent 5f140b2b
Branches
No related tags found
1 merge request!16Clhp map into main
......@@ -60,15 +60,12 @@ class _MapContainerWidgetState extends State<MapContainerWidget> {
void handleSelection(int index) {
String indexString = index.toString();
setState(() {
selectedSubDiv = widget.subdivisions[index];
for (Measurement measurement in widget.measurements) {
for (SubDiv subdivision in measurement.subDivs) {
if (subdivision.sub_div_id == indexString) {
//selectedSubDiv = subdivision;
selectedSubDiv = widget.subdivisions[index];
selectedMeasurement = measurement;
print("Print 1 in handleSelection");
print("SubdivID: ${subdivision.sub_div_id} indexString: $indexString index: $index");
break;
}
}
......
Source diff could not be displayed: it is too large. Options to address this: view the blob.
No preview for this file type
No preview for this file type
......@@ -52,18 +52,17 @@ def cut_map(self, cursor, lake_name: str, cell_size_in_km: float = 0.5):
# Combine the polygon and the grid to form the subdivisions
for line in lines:
if line.intersects(polygon):
intersection = line.intersection(polygon)
if intersection.is_empty:
continue # Skip if intersection is empty
divided_map.append(intersection)
divided_map.append(line.intersection(polygon))
break # NB test break
# List to store new GeoJSON feature objects
features = []
# Create subdivisions for each map tile
# Tracker variables
sub_div_id = 0
# Create subdivisions for each map tile
for tile in divided_map:
# Calculate tile center based on bounds, and round down to two decimals
min_x, min_y, max_x, max_y = tile.bounds
......@@ -90,7 +89,7 @@ def cut_map(self, cursor, lake_name: str, cell_size_in_km: float = 0.5):
},
'geometry': geometry
}
# Append new feature oject to list, and increment sub_div_id for next iteration
# Append new feature object to list, and increment sub_div_id for next iteration
features.append(tile_feature)
sub_div_id += 1
......
......@@ -160,10 +160,9 @@ def fill_remaining_subdivisions(lake_name: str, processed_ids: list):
# Fetch weather data for each subdivision from the NVE model
# NB hard coded date to december 2024 for testing, remove to_date param before use
temp_to_date = "2024-10-12"
temp_from_date = "2024-10-19"
ice_stats = get_raw_dates(ice_prognosis_raw_data(
sub_div_id=sub_div_id, x=center_lat, y=center_lng), to_date=temp_to_date, from_date=temp_from_date)
# temp_to_date = "2024-10-12"
# temp_from_date = "2024-10-19"
ice_stats = get_raw_dates(ice_prognosis_raw_data(sub_div_id=sub_div_id, x=center_lat, y=center_lng))
if len(ice_stats) > 0 and len(ice_stats[0]) > 0:
total_ice_thickness = ice_stats[0]['Total ice (m)']
......@@ -220,6 +219,7 @@ def addTestData(self, lake_name: str):
"""
try:
test_data = []
sub_div_id = 0
for measurement_id in range(5):
measurement = {
......@@ -239,7 +239,7 @@ def addTestData(self, lake_name: str):
for subdiv_id in range(30):
subdivision = {
"SubdivID": subdiv_id + 10*measurement_id,
"SubdivID": sub_div_id,
"MinThickness": round(random.uniform(4, 20), 1),
"AvgThickness": round(random.uniform(2, 15), 1),
"CenLatitude": random.uniform(60, 61),
......@@ -248,6 +248,7 @@ def addTestData(self, lake_name: str):
}
measurement["Subdivisions"].append(subdivision)
sub_div_id += 1
test_data.append(measurement)
# Overwrite the lidar data file
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment