hotosm / tasking-manager

Tasking Manager - The tool to team up for mapping in OpenStreetMap
https://wiki.openstreetmap.org/wiki/Tasking_Manager
BSD 2-Clause "Simplified" License
509 stars 275 forks source link

Improve integration with AI-assisted mapping #2065

Closed pantierra closed 2 years ago

pantierra commented 4 years ago

So far:

Let's think about making AI-assisted mapping a standard feature of Tasking Manager.

jayenashar commented 4 years ago

Is there documentation on how I can setup a tasking manager with RapiD? Or migrate an existing tasking-manager?

willemarcel commented 4 years ago

@jayenashar Do you want to make RapiD your main editor or just give users the option to use it?

jayenashar commented 4 years ago

if there's no licensing issues, the main editor.

willemarcel commented 4 years ago

@jayenashar we are going to integrate RapiD inside TM on the next few months, for now I think you could:

replace '?editor=ID' by 'https://mapwith.ai/rapid' on https://github.com/hotosm/tasking-manager/blob/fix/env-var-instructions/frontend/src/utils/openEditor.js#L18 and replace iD by RapiD on that line https://github.com/hotosm/tasking-manager/blob/develop/frontend/src/utils/editorsList.js#L6

Let me know if that solution works.

jayenashar commented 4 years ago

did you mean to paste a link to the same line in two separate branches?

i was able to do the first replacement, but now the TM goes to a URL like https://tasks.smartcitiestransport.com/projects/1/map/https://mapwith.ai/rapid?#map=16/-37.08585785263673/144.1571044921875&comment=%23oceania-tm-project-1%20%23buildings&gpx=https%3A%2F%2Ftasks.smartcitiestransport.com%2Fapi%2Fv2%2Fprojects%2F1%2Ftasks%2Fqueries%2Fgpx%2F%3Ftasks%3D835&presets=building

willemarcel commented 4 years ago

@jayenashar sorry, the second link I pasted was wrong. I fixed it on my previous comment.

willemarcel commented 4 years ago

Actually, replace that line: https://github.com/hotosm/tasking-manager/blob/fix/env-var-instructions/frontend/src/utils/openEditor.js#L18

by:

const rapidUrl = 'https://mapwith.ai/rapid';
windowObjectReference.location.href = getIdUrl(project, center, zoom, selectedTasks, rapidUrl);
return '?editor=CUSTOM';
willemarcel commented 4 years ago

@jayenashar you'll also need to move that if statement to after the following one.

jayenashar commented 4 years ago

here's my diff:

diff --git a/frontend/src/utils/openEditor.js b/frontend/src/utils/openEditor.js
index 761ff3b2..6844b8e6 100644
--- a/frontend/src/utils/openEditor.js
+++ b/frontend/src/utils/openEditor.js
@@ -15,7 +15,12 @@ export function openEditor(
   }
   const { center, zoom } = getCentroidAndZoomFromSelectedTasks(tasks, selectedTasks, windowSize);
   if (editor === 'ID') {
-    return getIdUrl(project, center, zoom, selectedTasks, '?editor=ID');
+    if (windowObjectReference == null || windowObjectReference.closed) {
+      windowObjectReference = window.open('', `iD-${project}-${selectedTasks}`);
+    }
+    const rapidUrl = 'https://mapwith.ai/rapid';
+    windowObjectReference.location.href = getIdUrl(project, center, zoom, selectedTasks, rapidUrl);
+    return '?editor=CUSTOM';
   }
   if (windowObjectReference == null || windowObjectReference.closed) {
     windowObjectReference = window.open('', `iD-${project}-${selectedTasks}`);

it opens rapid but doesn't zoom to the task. i was also a little confused by windowObjectReference == null since windowObjectReference is undefined not null

willemarcel commented 4 years ago

What's the URL it's generating?

If you want your users to use only Rapid, another solution would be to set a custom editor on all projects and activate only the custom editor on all projects.

jayenashar commented 4 years ago

looks like it opened this:

https://mapwith.ai/rapid?#map=NaN/NaN/-Infinity&comment=%23oceania-tm-project-1%20%23buildings&gpx=https%3A%2F%2Ftasks.smartcitiestransport.com%2Fapi%2Fv2%2Fprojects%2F1%2Ftasks%2Fqueries%2Fgpx%2F%3Ftasks%3D&presets=building

which redirected to:

https://mapwith.ai/rapid?#comment=%23oceania-tm-project-1%20%23buildings&disable_features=boundaries&gpx=https://tasks.smartcitiestransport.com/api/v2/projects/1/tasks/queries/gpx/%3Ftasks%3D&map=NaN/NaN/-Infinity&presets=building

and then:

https://mapwith.ai/rapid?#background=Maxar-Premium&comment=%23oceania-tm-project-1%20%23buildings&disable_features=boundaries&gpx=https://tasks.smartcitiestransport.com/api/v2/projects/1/tasks/queries/gpx/%3Ftasks%3D&map=NaN/NaN/-Infinity&presets=building

and i think finally stopped redirected on:

https://mapwith.ai/rapid?#background=Maxar-Premium&disable_features=boundaries&gpx=https://tasks.smartcitiestransport.com/api/v2/projects/1/tasks/queries/gpx/%3Ftasks%3D&map=2.00/-84.1/267.2&presets=building

Aadesh-Baral commented 2 years ago

Hello everyone, integration of RapiD inside TM is complete now. Integrated Rapid can be enabled while creating/editing a project on the settings tab.

enabling_integrated_rapid