Skip to content

Commit 89a98a8

Browse files
committed
Merge branch 'dev' of github.com:mapswipe/python-mapswipe-workers into dev
2 parents 1b2779e + 9654874 commit 89a98a8

File tree

8 files changed

+97
-30
lines changed

8 files changed

+97
-30
lines changed

manager_dashboard/manager_dashboard/create.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ <h3>Project Type Specific Information</h3>
173173
<ul>
174174
<li>
175175
<label for="zoomLevel">Zoom Level</label>
176-
<input type="number" name="zoomLevel" id="zoomLevel" value="18" min="14" max="24">
176+
<input type="number" name="zoomLevel" id="zoomLevel" value="18" min="14" max="22">
177177
<span>We use the Tile Map Service zoom levels. Please check for your area which zoom level is available. For example, Bing imagery is available at zoomlevel 18 for most regions. If you use a custom tile server you may be able to use even higher zoom levels.</span>
178178
</li>
179179
<li>
@@ -276,7 +276,7 @@ <h3>Project Type Specific Information</h3>
276276
<ul>
277277
<li>
278278
<label for="zoomLevelChangeDetection">Zoom Level</label>
279-
<input type="number" name="zoomLevelChangeDetection" id="zoomLevelChangeDetection" value="18" min="16" max="24">
279+
<input type="number" name="zoomLevelChangeDetection" id="zoomLevelChangeDetection" value="18" min="16" max="22">
280280
<span>We use the Tile Map Service zoom levels. Please check for your area which zoom level is available. For example, Bing imagery is available at zoomlevel 18 for most regions. If you use a custom tile server you may be able to use even higher zoom levels.</span>
281281
</li>
282282
<li>

manager_dashboard/manager_dashboard/js/forms.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,9 @@ function openFile(event) {
148148
// check project size
149149

150150
area = turf.area(feature)/1000000 // area in square kilometers
151-
maxArea = (20 - zoomLevel) * (20 - zoomLevel) * 1250
151+
maxArea = (23 - zoomLevel) * (23 - zoomLevel) * 200
152152
console.log('project size: ' + area + ' sqkm')
153-
if (area > 5000) {
153+
if (area > maxArea) {
154154
throw 'project is to large: ' + area + ' sqkm; ' + 'max allowed size for this zoom level: ' + maxArea + ' sqkm'
155155
}
156156
info_output.innerHTML += 'Project Size: ' + area + ' sqkm<br>';

mapswipe_workers/mapswipe_workers/project_types/build_area/build_area_project.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,13 @@ def validate_geometries(self):
114114

115115
# calculate max area based on zoom level
116116
# for zoom level 18 this will be 5000 square kilometers
117-
max_area = (20 - int(self.zoomLevel)) * (20 - int(self.zoomLevel)) * 1250
117+
# max zoom level is 22
118+
if self.zoomLevel > 22:
119+
raise CustomError(
120+
f"zoom level is to large (max: 22): {self.zoomLevel}."
121+
)
122+
123+
max_area = (23 - int(self.zoomLevel)) * (23 - int(self.zoomLevel)) * 200
118124

119125
if project_area > max_area:
120126
logger.warning(

mapswipe_workers/mapswipe_workers/project_types/build_area/build_area_tutorial.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,8 @@ def generate_tutorial_data(tutorial):
5252
task_y = int(row[0].split("-")[2])
5353
grouped_tasks[category][row[3]]["task_x_list"].append(task_x)
5454
grouped_tasks[category][row[3]]["task_y_list"].append(task_y)
55-
url = t.tile_coords_zoom_and_tileserver_to_URL(
56-
task_x,
57-
task_y,
58-
zoom,
59-
tutorial["tileServer"]["name"],
60-
auth.get_api_key(tutorial["tileServer"]["name"]),
61-
None,
62-
None,
55+
url = t.tile_coords_zoom_and_tileserver_to_url(
56+
task_x, task_y, zoom, tutorial["tileServer"]
6357
)
6458
grouped_tasks[category][row[3]]["url_list"].append(url)
6559
grouped_tasks[category][row[3]]["reference_answer_list"].append(row[1])

mapswipe_workers/mapswipe_workers/project_types/change_detection/change_detection_project.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,13 @@ def validate_geometries(self):
117117

118118
# calculate max area based on zoom level
119119
# for zoom level 18 this will be 5000 square kilometers
120-
max_area = (20 - int(self.zoomLevel)) * (20 - int(self.zoomLevel)) * 1250
120+
# max zoom level is 22
121+
if self.zoomLevel > 22:
122+
raise CustomError(
123+
f"zoom level is to large (max: 22): {self.zoomLevel}."
124+
)
125+
126+
max_area = (23 - int(self.zoomLevel)) * (23 - int(self.zoomLevel)) * 200
121127

122128
if project_area > max_area:
123129
logger.warning(

mapswipe_workers/mapswipe_workers/project_types/change_detection/change_detection_tutorial.py

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -45,23 +45,11 @@ def generate_tutorial_data(tutorial):
4545
task_y = feature["properties"]["TileY"]
4646
task_id_real = "{}-{}-{}".format(zoom, task_x, task_y)
4747

48-
urlA = t.tile_coords_zoom_and_tileserver_to_URL(
49-
task_x,
50-
task_y,
51-
zoom,
52-
tutorial["tileServerA"]["name"],
53-
tutorial["tileServerA"]["apiKey"],
54-
tutorial["tileServerA"]["url"],
55-
None,
48+
urlA = t.tile_coords_zoom_and_tileserver_to_url(
49+
task_x, task_y, zoom, tutorial["tileServerA"]
5650
)
57-
urlB = t.tile_coords_zoom_and_tileserver_to_URL(
58-
task_x,
59-
task_y,
60-
zoom,
61-
tutorial["tileServerB"]["name"],
62-
tutorial["tileServerB"]["apiKey"],
63-
tutorial["tileServerB"]["url"],
64-
None,
51+
urlB = t.tile_coords_zoom_and_tileserver_to_url(
52+
task_x, task_y, zoom, tutorial["tileServerB"]
6553
)
6654

6755
if group_id not in tasks_dict.keys():
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{
2+
"name": "Change Detection Tutorial",
3+
"projectType": 3,
4+
"projectId": "change_detection_tutorial",
5+
"zoomLevel": 16,
6+
"lookFor": "CHANGES IN BUILDINGS",
7+
"status": "change_detection_tutorial",
8+
"projectDetails": "This is a tutorial",
9+
"progress": 0,
10+
"contributorCount": 0,
11+
"tileServerA" : {
12+
"apiKey" : "AopsdXjtTu-IwNoCTiZBtgRJ1g7yPkzAi65nXplc-eLJwZHYlAIf2yuSY_Kjg3Wn",
13+
"captions" : "",
14+
"date" : "",
15+
"name" : "bing",
16+
"url" : "https://ecn.t0.tiles.virtualearth.net/tiles/a{quad_key}.jpeg?g=7505&mkt=en-US&token={key}",
17+
"credits": "© 2019 Microsoft Corporation, Earthstar Geographics SIO"
18+
},
19+
"tileServerB" : {
20+
"apiKey" : "91e57457-aa2d-41ad-a42b-3b63a123f54a",
21+
"captions" : "",
22+
"date" : "",
23+
"name" : "maxar_premium",
24+
"url" : "https://services.digitalglobe.com/earthservice/tmsaccess/tms/1.0.0/DigitalGlobe%3AImageryTileService@EPSG%3A3857@jpg/{z}/{x}/{y}.jpg?connectId={key}",
25+
"credits": "© 2019 Maxar"
26+
},
27+
"examplesFile": "sample_data/change_detection_tutorial_tasks_bing.geojson",
28+
"categories": {
29+
"changes_1": {
30+
"pre": "For this project we are looking for new settlements. Compare the upper (before) and lower (after) image and *SWIPE RIGHT* (not tap) to indicate that new settlements have been built.",
31+
"post_correct": "Yes, that looks like a new settlement being developed. Plenty of new houses and huts have been built in this area. Swipe left to continue the tutorial.",
32+
"post_wrong": "Oh no. Make sure to spot all the new settlements and swipe right. New roads can also function as an indicator sometimes."
33+
},
34+
"changes_2": {
35+
"pre": "And again: If new settlements have been built, *SWIPE* to the right side.",
36+
"post_correct": "Correct. We can spot new settlements in the upper right part of the satellite image. Swipe left to go on with some more examples.",
37+
"post_wrong": "Take a closer look. There are new settlements here in the upper right part of the satellite image."
38+
},
39+
"no_changes_1": {
40+
"pre": "In this example, there are many buildings but *NO NEW SETTLEMENTS* emerged. *SWIPE* left to indicate no changes.",
41+
"post_correct": "Nice. Just watch out for changes referring to settlements. Swipe left to continue.",
42+
"post_wrong": "Oh no. Not all changes refer to new settlements, some are just related to agriculture or vegetation."
43+
},
44+
"no_changes_2": {
45+
"pre": "We might spot changes in the vegetation for this imagery pair, but no changes related to settlements. Again, *SWIPE LEFT*.",
46+
"post_correct": "Cool. You got it. Just look out for changes concerning settlements.",
47+
"post_wrong": "Sorry, try again. Don't be distracted by changes in vegetation, just look out for settlements."
48+
},
49+
"maybe_1": {
50+
"pre": "Sometimes it might be unclear if settlements emerged. Swipe down if you are not sure.",
51+
"post_correct": "Great. We cannot really tell if the building at the bottom left is a new settlement. This is a 'maybe'.",
52+
"post_wrong": "Are you really sure? Sometimes it's better to mark the imagery as 'not sure'."
53+
},
54+
"bad_imagery_1": {
55+
"pre": "Swipe up to indicate if there is no imagery or if there are clouds.",
56+
"post_correct": "That's right, that image was way too cloudy to make a good assessment!",
57+
"post_wrong": "It there is no imagery or clouds, we cannot tell the right answer. Make sure to mark this as well by swiping up."
58+
}
59+
}
60+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"type": "FeatureCollection",
3+
"name": "change_detection_tutorial_tasks_18",
4+
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
5+
"features": [
6+
{ "type": "Feature", "properties": { "TileZ": 18, "reference": 1, "id": 1, "category": "changes_1", "TileX": 146136, "TileY": 126866 }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ 20.687255859375, 5.76630318845997 ], [ 20.6886291503906, 5.76630318845997 ], [ 20.6886291503906, 5.76493684469301 ], [ 20.687255859375, 5.76493684469301 ], [ 20.687255859375, 5.76630318845997 ] ] ] ] } },
7+
{ "type": "Feature", "properties": { "TileZ": 18, "reference": 1, "id": 1, "category": "changes_2", "TileX": 146138, "TileY": 126875 }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ 20.6900024414062, 5.75400597619731 ], [ 20.6913757324219, 5.75400597619731 ], [ 20.6913757324219, 5.75263960285187 ], [ 20.6900024414062, 5.75263960285187 ], [ 20.6900024414062, 5.75400597619731 ] ] ] ] } },
8+
{ "type": "Feature", "properties": { "TileZ": 18, "reference": 0, "id": 1, "category": "no_changes_1", "TileX": 146116, "TileY": 126871 }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ 20.6597900390625, 5.75947143673713 ], [ 20.6611633300781, 5.75947143673713 ], [ 20.6611633300781, 5.75810507652999 ], [ 20.6597900390625, 5.75810507652999 ], [ 20.6597900390625, 5.75947143673713 ] ] ] ] } },
9+
{ "type": "Feature", "properties": { "TileZ": 18, "reference": 0, "id": 1, "category": "no_changes_2", "TileX": 146121, "TileY": 126886 }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ 20.6666564941406, 5.73897568897884 ], [ 20.6680297851562, 5.73897568897884 ], [ 20.6680297851562, 5.7376092795666 ], [ 20.6666564941406, 5.7376092795666 ], [ 20.6666564941406, 5.73897568897884 ] ] ] ] } },
10+
{ "type": "Feature", "properties": { "TileZ": 18, "reference": 2, "id": 1, "category": "maybe_1", "TileX": 146127, "TileY": 126886 }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ 20.6748962402344, 5.73897568897884 ], [ 20.67626953125, 5.73897568897884 ], [ 20.67626953125, 5.7376092795666 ], [ 20.6748962402344, 5.7376092795666 ], [ 20.6748962402344, 5.73897568897884 ] ] ] ] } },
11+
{ "type": "Feature", "properties": { "TileZ": 18, "reference": 3, "id": 1, "category": "bad_imagery_1", "TileX": 146127, "TileY": 126888 }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ 20.6748962402344, 5.73624286688015 ], [ 20.67626953125, 5.73624286688015 ], [ 20.67626953125, 5.73487645092028 ], [ 20.6748962402344, 5.73487645092028 ], [ 20.6748962402344, 5.73624286688015 ] ] ] ] } }
12+
]
13+
}

0 commit comments

Comments
 (0)