If you have been playing around with the new Mapbox Studio you might be interested to know how to make a custom map with objects of your own interest from OpenStreetMap.
To make the process of creating an updating an OSM based dataset on Mapbox more seamless, I was looking into a command line based workflow that could extract OSM data from Overpass and update a Mapbox hosted dataset in one go.
- Use Overpass Turbo to create a query for the data you are interested in extracting. Since i'm interested in bus stops, I first browse the map to Bengaluru, India and then generate a query using the wizard query
highway=bus_stop
- Test your query by confirming that the results on the map are as expected
- Export the query in compact form and save the resulting query to a
query.ql
file[out:json][timeout:25];(node["highway"="bus_stop"](12.946554043930224,77.56158828735352,12.983816808126269,77.62420177459717););out body;>;out skel qt;
- In terminal run
query-overpass query.ql --flat-properties > output.geojson
to download the OSM features into a geojson file - Run
mapbox upload mapbox_username.mapid output.geojson
to create or update a dataset on Mapbox with the geojson.
Known bugs
Cannot create a tileset with multiple datasets
Uploading individual datasets will each create a new tileset with different mapids. There is currently no way to upload them into a single mapid.
- Visit the Mapbox data page to check the status of your upload
- Once uploaded, open the dataset and add it to your map
@planemad
You're just in time
I am preparing presentation about using Mapbox Studio (how to obtain data form OSM and style it) for the GIS-Forum
👍 💥