facebook / Rapid

The OpenStreetMap editor driven by open data, AI, and supercharged features
https://rapideditor.org
ISC License
503 stars 92 forks source link

Add Map Roulette Integration to Rapid #1150

Closed atiannicelli closed 1 month ago

atiannicelli commented 11 months ago

Description

OK, so the TL;DR is that I want to be able to open up Rapid and look at the map and see all the Map Roulette Issues on the map and address them.

This is how I would propose that the feature is added:

  1. Add a new Section to the "Issues" panel that would be "MapRoulette Tasks" This new section would be a check box to enable or disable map roulette tasks. Once enabled I would propose that there is an additional box that would allow the user enter a Map Roulette Challenge ID so that the user would only see the issues from a specific challenge populated on the map. Screenshot 2023-10-06 at 1 18 49 PM

The user would be able to get that challenge ID from the URL that they are using to look at the map roulette challenge Screenshot 2023-10-06 at 1 26 00 PM

Once the user has enabled maproulette tasks and optionally filled in a specific challenge ID then Rapid would use the Map Roulette API to fetch the Tasks from the bounding box as shown on the map.

curl -X 'PUT' \ 'https://maproulette.org/api/v2/tasks/box/-71.0749/42.3564/-71.0868/42.3764?limit=5&page=0&excludeLocked=false&order=ASC&includeTotal=false&includeGeometries=true&includeTags=false' \ -H 'accept: application/json'

[
...
  {
    "id": 186693991,
    "owner": -1,
    "ownerName": "",
    "title": "w817137122@2",
    "parentId": 41497,
    "parentName": "Boston - Untagged Crossing Ways",
    "point": {
      "lat": 42.3703402020978,
      "lng": -71.0801099567685
    },
    "bounding": "",
    "blurb": "",
    "modified": "2023-10-06T17:48:31.605Z",
    "difficulty": -1,
    "type": 2,
    "status": 0,
    "pointReview": {},
    "priority": 0
  },
...
]

Each of the returned items would be added on the map as a dot of some kind as the point indicated in the data retrieved.

curl -X 'GET' \ 'https://maproulette.org/api/v2/task/186693991' \ -H 'accept: application/json'

{
  "id": 186693991,
  "name": "w817137122@2",
  "created": "2023-10-06T14:52:10.172Z",
  "modified": "2023-10-06T14:53:46.747Z",
  "parent": 41497,
  "instruction": "",
  "location": {
    "type": "Point",
    "coordinates": [
      -71.0801099567685,
      42.3703402020978
    ]
  },
  "geometries": {
    "type": "FeatureCollection",
    "features": [
      {
        "type": "Feature",
        "geometry": {
          "crs": {
            "type": "name",
            "properties": {
              "name": "EPSG:0"
            }
          },
          "type": "LineString",
          "coordinates": [
            [
              -71.0801215,
              42.3702846
            ],
            [
              -71.0801112,
              42.3703298
            ],
            [
              -71.0800999,
              42.3703961
            ]
          ]
        },
        "properties": {
          "footway": "crossing",
          "highway": "footway",
          "surface": "asphalt",
          "priority": 0,
          "identifier": "w817137122@2",
          "instructions": "None",
          "osmIdentifier": "way/817137122"
        }
      }
    ]
  },
  "status": 0,
  "review": {},
  "priority": 0,
  "changesetId": -1,
  "errorTags": "",
  "tags": []
}

Node: If the instructions are "none" then you might need to fetch the instructions from the challenge. curl -X 'GET' \ 'https://maproulette.org/api/v2/challenge/41497' \ -H 'accept: application/json'

Then Rapid would pop up a box with the following info: Challenge Name, Feature ID, Instructions, etc

Also there would be a Button to "Lock" the task (so no one else works on this task). If the lock doesn't work then you report that someone else has it locked. If the Lock works then display the locked state.

The mapper then fixes the issue and clicks one of the resolution buttons on the dialog box associated with this issue. "fixed", "not an issue", "too hard", "skip", "already fixed". Rapid would then update the task and unlock it.

Note: I don't know that locking is that important. It is more important for mapathons when lots of people are working on the same challenge. In most cases it is not needed.

I'd like to be able to see the dots and zoom in and fix a bunch of issues and then click the dots and "fix" each one.

To be able to lock and update the MR task the mapper will have had to enter a Map Roulette UserID.

Note: I don't know what the API to fetch tasks from a specific challenge in a bounding box is. I've asked because they must have it... or maybe they get all and filter on the "parent" field? (yuck).

There is JOSM plugin that performs this entire workflow if you are interested. Map Roulette swagger is here: https://maproulette.org/docs/swagger-ui/index.html#/

tsmock commented 11 months ago

There is JOSM plugin that performs this entire workflow if you are interested.

Poke me if there are questions on the API.

danieldegroot2 commented 11 months ago

cc: @mvexel

Bonkles commented 10 months ago

All righty- there's a lot of raw material here to work with, so let's break this work down.

Maproulette has challenges, which are themed groupings of small tasks. For example, somebody might create a challenge that's to 'map all the parking spaces in a city', consisting of thousands of tasks to map a single parking lot. Challenge creators have a lot of latitude in the tasks they create- they can include descriptions of what the challenge requires. Some challenges might ask for simple things like 'if this is a parking lot, just draw the perimeter of the parking lot'. The same challenge could instead be much more detailed and might ask the user to map the individual parking spot geometries, parking ways with directional information, etc. It's very open and free-form, which makes this task quite a big one!

Task 1: Getting started and Understanding the API

After this investigation, you should have a handle on the API. Now see if you can hand-construct some API calls using a tool such as curl or postman:

Bonkles commented 10 months ago

@voscarmv Next task will be to write a Service in Rapid to obtain all of the challenges in an area, and all the tasks for a specific challenge. I'll fill that in when we get to it. :)

tsmock commented 10 months ago

If you need some sample API returns, https://github.com/JOSM/MapRoulette/tree/master/src/test/resources/__files/api/v2 has samples from MapRoulette's API (note: the responses are ~9 months old at this point)

atiannicelli commented 10 months ago

Since it was not easy to find I thought I'd answer the extra credit :) I did find out how to get tasks in a specific bounding box using the /tasks/box/ API. I forgot to post that I had asked the developers how to do it and they replied that the /tasks/box API should work and you can add a "cid" to show tasks from a specific challenge or "pid" if you want tasks from a project. (A project is just a collection of challenges).

Also, if you have MapRoulette specific API questions you can ask them in the maproulette-dev channel on the OpenStreetMap slack (osmus.slack.com).

voscarmv commented 10 months ago

Thank you for the tips @tsmock and @atiannicelli !

Bonkles commented 8 months ago

https://github.com/maproulette/maproulette3/issues/2211 was filed by Alex I. as a result of @voscarmv's investigation.

Bonkles commented 1 month ago

This feature landed in 2.3 and is receiving updates in 2.4. Closing!