Export OpenStreetMap Data with Overpass Turbo
This tutorial will walk you through the basics of exporting OpenStreetMap data using Overpass Turbo. This tutorial is for users who are familiar with OpenStreetMap data and interested in learning how to run more advanced queries to extract specific map features tagged in OpenStreetMap. If you are new to OpenStreetMap, check out our introductory tutorial on Importing OpenStreetMap Data first.
What is Overpass Turbo?
The Overpass Turbo web interface allows us to run queries on OpenStreetMap data in order to extract map features that might be of interest including waterways, commercial businesses, fountains and much more. The OpenStreetMap wiki contains a full write up on all the map features tagged in OpenStreetMap. Take a look to become familiar with the map features tagged by OpenStreetMap users.
The Overpass Turbo web interface should be used for queries in which a small dataset is being extracted. It is best to be well zoomed in to limit the size of the dataset that is exported. Users interested in downloading larger datasets should use the Overpass API instead.
However, Overpass Turbo is a great web interface for testing Overpass API queries, and immediately seeing the results mapped. The OpenStreetMap wiki contains more information on use-cases for Overpass Turbo.
The Overpass Turbo Web Interface
You can run queries directly from Overpass Turbo by navigating to the website.
From the left sidebar, you can write queries, which you can run and instantly see mapped. After writing an Overpass query, select the “Run” menu option in the upper left menu to see the results of your query.
Additional menu options of note include “Export” for downloading your OpenStreetMap data, and the “Wizard” which will help you in writing queries.
If you are unfamiliar with Overpass Turbo queries, you can run sample queries by selecting the “Load” menu option.
There are several ways in which you can move the map to the area you are interested in extracting data from. You can search for a location using the search bar in the upper left corner of the map. You can zoom in and out using the plus and minus icons. You can also move the map to your current location using the “locate me” menu option.
Running Queries in Overpass Turbo
Let’s take a look at the sample query pre-loaded in the left sidebar when you arrive on the site.
The query searches for features that are of the type node. You can find out the different data types assigned to various map features on the OpenStreetMap wiki.
The query searches for map features that have the key “amenity” that equal the value “drinking_water.” The variable uses the map’s bounding box to run the search against.
You can use the “Wizard” menu option to search for map features, and automatically build and run queries.
Using OpenStreetMap Data in CARTO
Once you have the OpenStreetMap data you wish to use in CARTO, select the “Export” menu option. You will be prompted to choose a file format for your data. CARTO supports many file formats including GeoJSON, KML, and GPX. Once you select a file format supported by CARTO, your data will be immediately downloaded.
CARTO is setup to easily handle the import of data. Simply navigate to the Datasets section of your dashboard, select “Connect Dataset” and upload the downloaded file. Once the data is imported, you will be able to view it from the Data View of the CARTO Editor.
Once your data is uploaded, don’t forget to cite the source of the data back to OpenStreetMap and Overpass Turbo in the descripton of your dataset. As part of using OpenStreetMap data, you must give credit to OpenStreetMap per their Copyright and License agreement. You should add an OpenStreetMap link and credit if you don’t plan on using an OSM basemap where the credit is already included by CARTO.
You can add attribution to OpenStreetMap by editing the metadata associated with your dataset by selecting the “Edit metadata” link in the upper left corner of your dataset in the Data View of the CARTO Editor.
Add the attribution tag to the metadata description.
That’s it! Now you can easily use OpenStreetMap data in any of your maps from within the CARTO Editor.