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

fix: cell sizing formula

parent 358b0c60
No related branches found
No related tags found
1 merge request!16Clhp map into main
......@@ -50,6 +50,9 @@ class ChoroplethMapState extends State<ChoroplethMap> {
}
}
// Sort the list of SubDiv objects based on each subdivision id
_subdivisions.sort((a, b) => a.sub_div_id.compareTo(b.sub_div_id));
dataSource = MapShapeSource.memory(
widget.relation,
shapeDataField: 'sub_div_id',
......
No preview for this file type
......@@ -9,19 +9,6 @@ from shapely.geometry import Polygon, LineString, MultiLineString
from server.consts import LAKE_RELATIONS_PATH
'''
# 0
starting coordinate (x,y)
# 1
1 deg lat = 111.32km
1 deg lng = 40075km * cos( lat ) / 360
# 2 Formulas for calculating a distance in kilometers to a distance in latitude and longitude
lat = distance_in_km/111.32km
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, cell_size_in_km: float = 0.5):
......@@ -47,7 +34,7 @@ def cut_map(self, cursor, lake_name: str, cell_size_in_km: float = 0.5):
divided_map = []
# Convert the cell size to degrees
cell_size = cell_size_in_km * 10
cell_size = cell_size_in_km * 2
cell_width = cell_size / 111.32
# A slightly more complicated formula is required to calculate the height. This ensures that
# the height in km is equal to the width in km regardless of the latitude.
......
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