Skip to content

Commit 7efabcb

Browse files
authored
Merge pull request #487 from mapswipe/fix-wrong-area-threshold
Fix wrong area threshold
2 parents a34c5c3 + 51d93e4 commit 7efabcb

File tree

2 files changed

+7
-5
lines changed
  • manager_dashboard/manager_dashboard/js
  • mapswipe_workers/mapswipe_workers/project_types/tile_map_service_grid

2 files changed

+7
-5
lines changed

manager_dashboard/manager_dashboard/js/forms.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,10 @@ function openFile(event) {
233233

234234
// check project size, based on zoom level
235235
var zoomLevel = parseInt(document.getElementById('zoomLevel').value);
236-
maxArea = (23 - zoomLevel) * (23 - zoomLevel) * 200
236+
// 20,480 sqkm for zoom 17
237+
// 5,120 sqkm for zooom 18
238+
// 1,280 sqkm for zoom 19
239+
maxArea = 5 * (4 ** (23 - zoomLevel))
237240
console.log('project size: ' + sumArea + ' sqkm')
238241

239242
if (sumArea > maxArea) {

mapswipe_workers/mapswipe_workers/project_types/tile_map_service_grid/project.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,9 @@ def validate_geometries(self):
154154
# We calculate the max area based on zoom level.
155155
# This is an approximation to restrict the project size
156156
# in respect to the number of tasks.
157-
# At zoom level 22 the max area is set to 200 square kilometers.
158-
# For zoom level 18 this will result in an max area of 5000 square kilometers.
159-
# (23-18) * (23-18) * 200 = 5000
160-
max_area = (23 - int(self.zoomLevel)) * (23 - int(self.zoomLevel)) * 200
157+
# At zoom level 22 the max area is set to 20 square kilometers.
158+
# For zoom level 18 this will result in an max area of 5,120 square kilometers.
159+
max_area = 5 * 4 ** (23 - self.zoomLevel)
161160

162161
if project_area > max_area:
163162
logger.warning(

0 commit comments

Comments
 (0)