Image for post
Image for post
Facebook RapiD predicted roads in Duango, Mexico

Mapping Remote Roads with OpenStreetMap, RapiD, and QGIS

Michal Migurski
Oct 31, 2019 · 7 min read

This tutorial was originally part of a joint workshop between DirectRelief, NetHope, and Facebook at the 2019 NetHope Global Summit in San Juan, PR.

The team I work with at Facebook has been busy releasing and updating RapiD, a version of the primary OpenStreetMap (OSM) iD editor that helps every mapper make fast, high-quality, and accurate edits using roads suggested by our AI-assisted road import process. We’ve been expanding OSM in countries like Thailand, Indonesia, and now Malaysia with a robot-assisted process that pairs advanced imagery processing to find likely roads in fresh aerial imagery with human oversight to confirm and add roads to OSM. Initially these tools were available internally but now they’re easy to use for anyone. In combination with up-to-the-minute OSM extracts it’s possible to integrate OSM into a GIS environment in a single session using just browser-based tools.

Check out a short video of RapiD in action, before and after robot-assisted road suggestions or read more about it on the OSM wiki.

In this tutorial I’ll show how to view robot-suggested additions to OSM with RapiD, save them to the map, get your data back out with Protomaps Extracts, and use the resulting data in QGIS. I’ll also show how RapiD can be used with popular OSM tools like Maproulette and HOT Tasking Manager, for when you want to help build the map but you’re not sure what to do.

Before You Start

Download and install a recent version of QGIS, the free and open source Geographic Information System from qgis.org. Version 3.4 LTS (long-term support) lets you open OSM PBF files directly without needing to first convert them to Shapefile or GeoJSON.

If you don’t already have a free OpenStreetMap account, create one and log in at openstreetmap.org.

Image for post
Image for post
Log in or sign up for OpenStreetMap at openstreetmap.org
Image for post
Image for post
OSM account creation can take less than a minute

Add AI-Assisted Roads

We’re going to add some track roads through orchards down the coast from Bintulu, a coastal town on the island of Borneo in the central region of Sarawak, Malaysia.

Visit RapiD at mapwith.ai/rapid and navigate the map to Bintulu. Initially you’ll see aerial imagery, some basic labels, and a large button that says “Zoom in to edit”.

When you zoom in far enough, you can see features to edit. Here there are some orchard boundaries marked out with a few tracks already mapped. RapiD also shows roads colored purple. Purple roads are AI-assisted features where RapiD thinks that no OSM road exists but there might be one in the aerial imagery.

These purple roads are not in OSM, and you can add them to the map individually as you verify that they match the underlying imagery. When you click on a road, RapiD adds it to the map and it changes from purple to another color depending on its type.

Image for post
Image for post
Using a single machine-generated feature in OSM

Click around to add a few more roads in this area. The existing roads on the orchard were tagged as “unmaintained tracks”, so we’ll mark the new ones with the same tag to keep this map consistent with existing local mapping efforts.

Image for post
Image for post
Tagging the new road as an “unmaintained track” to match existing nearby tags from other OSM users

As you add roads, a number of features added or changed shows in the upper-right corner. Here we’ve added over 20 new segments of connected track in this orchard. Now we can hit the “Save” button to upload them to OSM.

Image for post
Image for post
Saving changes back to OSM

The first time you ask to save, RapiD will prompt you with an OSM authorization window. Click “Grant Access” to allow RapiD to upload these edits using the correct account.

Image for post
Image for post

Add some comments about the edit, hit “Upload”, and you’re done. RapiD might offer a few warnings about disconnected roads that you’ll want to fix before saving your changes.

Image for post
Image for post

Extract OSM Data to QGIS

Let’s get our newly-mapped data into QGIS with Protomaps Extracts at protomaps.com/extracts. This service reads new edits from OSM once per minute. Watch the “last update” time on the left side of the window to be sure your recent edits are included. You may need to wait 2–3 minutes to be sure.

We’ve named our extract “Bintulu Tracks” and made a rectangular selection around the area where we updated the orchard. Click “Create OSM PBF” to ask for an extracted piece of current OSM data for this area with recent changes.

Image for post
Image for post

Protomaps Extracts shows a set of progress bars as it builds the extract. A small and sparse area like this should just take a few seconds, while a larger or denser area might take longer to prepare.

Image for post
Image for post

Finally click the “Download PBF” button to get a file called Bintulu Tracks.osm.pbf.

Now we can switch to QGIS and open a new layer. OSM PBF files are supported directly in newer versions of QGIS and they can be opened in the same way as Shapefiles and other vector layers. QGIS creates five feature layers from the free-form tagged data with different geometry types and field definitions. Roads end up in the “lines” layer, buildings in “multipolygons”, and points of interest go in “points”.

Image for post
Image for post
Adding an OSM PBF file as a vector layer to QGIS results in up to five new sub-layers

Now we can see and use the new roads we just created alongside other GIS data, export them to other GIS formats, and use them in further workflows.

Image for post
Image for post
Zoom in to see recent changes including the ones we just made with RapiD
Image for post
Image for post
Inspect an individual feature to see its OSM properties, such as this new “highway=track” feature

Don’t Know Where To Edit?

What if you don’t know where to spend your effort in OSM? Several community tools have you covered. RapiD is already integrated into Maproulette, a spin-the-wheel style editor that directs your attention to a stream of easy, small changes and fixes. To begin, sign in with an OpenStreetMap account at maproulette.org.

Maproulette includes location challenges, and Facebook has created one for the East Malaysia region. Click “Start” to work on this challenge.

Maproulette will choose an area to map. RapiD may not be the default selected editor, so you may need to select it from the drop-menu above the “Edit” button.

Image for post
Image for post
Select “Edit in RapiD” to use Facebook’s ML-assisted roads

When you click “Edit”, RapiD will open in a new tab and work normally. Edit roads and other features in the selected area, save your changes, and close out RapiD as above to return to Maproulette. Finish up by telling Maproulette what you’ve done so the overall challenge can be completed.

Image for post
Image for post
Maproulette works best when you write descriptive notes about your changes

Humanitarian OpenStreetMap Team (HOT) also presents a selection of mapping tasks. HOT partners with organization such as the Red Cross to focus attention on areas in need of urgent attention due to ongoing or predicted natural disasters. HOT has created a special version of the Tasking Manager that integrates RapiD at tasks-assisted.hotosm.org, and you can log in with your OSM account just like with Maproulette.

The Tasking Manager flow is similar to Maproulette’s. There are instructions to select a challenge and a task, and the option of selecting RapiD for editing with machine-assisted roads.

Tasking Manager is especially useful for directed group efforts. For example, a large group of mappers might use it to break up an area into small pieces and edit in parallel. Everyone’s changes will be saved to OSM as they work. At any point in the exercise or upon completion, the saved OSM data can be extracted via Protomaps Extracts and used in a GIS environment.

Conclusion

This tutorial has shown how to incorporate suggested edits to OpenStreetMap provided by RapiD, Facebook’s AI-assisted OSM editor. New data is immediately available in Protomaps Extracts service for inclusion in GIS workflows. RapiD is also available via popular OSM tools like Maproulette and HOT Tasking Manager.

Key links:

Thanks

Thanks to encouragement, feedback, and testing from Drishtie, Jeff, Brandon, Andi, Alex, Mercedes, Andrew, Jen, Eugenia, Kevin, Danil, Stephanie, Tom, Melissa, David, Greg, and Rolando.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store