While our Red Cross volunteers were out mapping in West Africa, we asked them to record their GPS tracks using the OsmAnd Android application. Now that fieldwork is complete, we finally had a chance to look through the hundreds of GPX files that they recorded.
The first step was merging the many, many GPX files. There were 72,000 km of tracks recorded - equal to circling the Earth 1.8 times! Since the dataset was so large, the best way was to combine the files into a spatialite database.
Next, we cleaned up the data. This involved removing any GPX track points with a speed higher than 100 kph (which only happened when a staff member got on a flight and forgot to put their phone on airplane mode) and any track points that were floating in weird places (we had some points appear in Kenya and null island - these were from when the GPS on a phone was first turned on and was trying to search for a signal).
We mapped the data to see the full extent of how much ground the volunteers covered:
These data aren’t just pretty; they’re also useful for adding roads to OSM. Several areas in the border regions have really cloudy satellite imagery and we wouldn’t be able to trace the roads if it weren’t for the GPX data.
I used the GPX data to complete the road network. First, I needed to figure out which of the tracks were for roads that already existed in OSM. I did this by downloading the existing road data and calculating how far each GPX point was from an existing road.
There are several ways to do this. I did it by downloading the country-level OSM-PBF file from GeoFabrik (these are faster to download than shapefiles), converting this into a spatialite database, and filtering the data by highway=*
.
The GPX data and the roads data both had to be saved in an equal area projection so that the distance calculations would be accurate.
Within QGIS, I used the v.distance function in GRASS. It’s slightly hidden. You can find it under:
Processing -> Toolbox -> GRASS -> v.distance
This iterated through each of the GPX track points to determine the closest road and the distance between the road and the point. I took the output and filtered the data to only keep track points that were over 100 metres from an existing road. This left me with a set of points that needed to be traced into OSM, which I did using JOSM; you can add in a GPX track points layer on top of existing data and imagery.
Three days, 8 episodes of Game of Thrones, and one sore arm later, the tracing was complete. Through the volunteers’ efforts, we added about 600 km of roads into OSM, connecting some of the most inaccessible and remote communities in West Africa.
Thanks to all the volunteers who made this possible!