Skip to content

Commit 63b69cb

Browse files
committed
add rough idea to upload project to tm
1 parent 5e32935 commit 63b69cb

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

mapswipe_workers/mapswipe_workers/utils/geojson_functions.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ def create_group_geom(group_data, shape="bounding_box"):
122122
ring.AddPoint(lon_right, lat_bottom)
123123
ring.AddPoint(lon_left, lat_bottom)
124124
ring.AddPoint(lon_left, lat_top)
125+
# TODO: Make sure to return 2D geom, currently 3D with z = 0.0
125126
group_geom = ogr.Geometry(ogr.wkbPolygon)
126127
group_geom.AddGeometry(ring)
127128

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import json
2+
from mapswipe_workers.definitions import DATA_PATH
3+
4+
5+
def mapswipe_to_hot_tm_project(project_id, project_name):
6+
7+
# get project aoi
8+
aoi_file = f"{DATA_PATH}/api/project_geometries/project_geom_{project_id}.geojson"
9+
with open(aoi_file) as f:
10+
aoi_geojson = json.load(f)
11+
12+
# get tasks
13+
tasks_file = f"{DATA_PATH}/api/hot_tm/hot_tm_{project_id}.geojson"
14+
with open(tasks_file) as f:
15+
tasks_geojson = json.load(f)
16+
17+
data = {
18+
"arbitraryTasks": True,
19+
"areaOfInterest": aoi_geojson,
20+
"projectName": project_name,
21+
"tasks": tasks_geojson,
22+
}
23+
24+
print(data)
25+
26+
27+
mapswipe_project_id = "build_area_default_with_bing"
28+
tm_project_name = "benni_test"
29+
mapswipe_to_hot_tm_project(mapswpe_project_id, tm_project_name)

0 commit comments

Comments
 (0)