maproulette / maproulette3

MapRoulette, the micro-tasking tool for OpenStreetMap
https://maproulette.org
MIT License
128 stars 34 forks source link

Mapillary integration MVP #1947

Open mvexel opened 1 year ago

mvexel commented 1 year ago

Breaking out from #1737

Let's work on a first stab at Mapillary integration. The goal here is to enable anyone to create MapRoulette challenges based on sepecifc Mapillary detections classes. Let's start with a limited number of detections:

The main problems to solve are:

A rough description of the workflow would be:

  1. User creates new challenge
  2. Fourth option for task source would be added: "I want to use Mapillary detections"
  3. User would be able to select detection type from a dropdown (see options above, to be expanded later)
  4. User would define an area of interest
  5. [optional -- at this point we would query the API and provide an estimated number of tasks that the challenge would contain]
  6. [optional but really nice to have] we would query the overpass API and remove features that likely (based on proximity) are already mapped in OSM
  7. User would complete the challenge creation using the existing wizard options. #844 would also be a prerequisite.

contact person from Mapillary side: @cbeddow

cbeddow commented 1 year ago

@mvexel I want to suggest also: 1) street lamps (generally quite reliable data) and 2) utility poles (not as reliable but very helpful for Youthmappers projects in Africa)

for data retrieval, we have a decision to make

A) we can retrieve the data using the Mapillary API, in small batches because the API does a bbox search with up to 1000 results per request B) we can retrieve it from the vector tiles

I think API is most reliable because it has the most recent data (vector tile can lag in update/regen time when new imagery comes in) and is less complex (no decoding of tiles)

Here is a sample API request batch code in Python attached: api_download.zip

^ above code takes any bbox, and breaks it down into zoom18 sized tiles. Then instead of requesting those vector tiles (Mapillary only serves at zoom 14 anyway), the zoom 18 tiles are smaller bboxes to ensure not going over the response limit of 1000 objects. It iterates through all the smaller bboxes, and retrieves the data, then merges it together into 1 geojson.

cbeddow commented 1 year ago

For overpass de-dupe, I suggest we make a basic dict of the OSM values for each Mapillary value. Then easy to simply make an Overpass call with a small (10x10 meter or less) bbox as a "radius search"

cbeddow commented 1 year ago

We may also be able to request the images associated with each object, for previewing. Once we have a list of features we want the user to evaluate, for each feature we need to request like

https://graph.mapillary.com/?fields=images

This gives us a list of image IDs. Then we can retrieve the image URL for each of the images:

https://graph.mapillary.com/?fields=thumb_2048_url

We can get other image sizes also as needed:

We may also want to add to the list of fields to get image geometry, camera angle, or other attributes, if we want to show image location on the map. See options here: https://www.mapillary.com/developer/api-documentation#image