Getting OSM Data

This guide may be downloaded as Getting_OSM_Data_en.odt or Getting_OSM_Data_en.pdf
Reviewed 2016-04-05

When you want to get the most recent OpenStreetMap data, the easiest way is to download an extract from a website. There are various web services that provide data extracts for an area of your choosing.

Downloading Data Extracts


GeoFabrik is a company which specializes in working with OpenStreetMap. They provide a variety of free extracts in shapefile and raw OSM format on their download website. The advantage of downloading GeoFabrik data is that it is updated every day, and it’s easy and reliable. One disadvantage is that the data is extracted by country, and not all countries are available.


BBBike provides shapefiles and raw OSM format for cities around the world, extracted weekly. This is useful if you are looking for data extracts for a single city.

Remember that features in OpenStreetMap have an unlimited number of “free” tags, but shapefiles have attributes stored in a limited number of columns. This means that when OSM data is converted into shapefiles, only the specified tags will be included in the shapefile table. The websites listed above provide shapefiles with a default set of common tags, but if you want to extract specific tags you will need to use one of the more specialized services in the next section or learn how to export the data yourself.

OSM Extracts by Interline

Interline Technologies provides an OSM Extracts service with extracts for over 200 metro regions and cities around the world. Extracts are available as OSM PBF, GeoJSON, and GeoJSON Lines (one feature per line). Extracts are created daily. Download through stable URLs or using the PlanetUtils command-line interface. Registration is free but required.

Customized Extracts

HOT Export Tool

The Humanitarian OpenStreetMap Team has created an online service that allows users to create custom OSM extracts anywhere in the world, by selecting an area of interest, map features and file formats. The service is available at Within minutes, up-to-date OpenStreetMap (OSM) data is exported, filtered and converted. Areas of interest (AOI) can be selected through searching, bounding box coordinates, drawing a box, free drawing, using the view or importing a GeoJSON file. Current file formats includes Shapefile (.shp), GeoPackage (.gpkg), Garmin (.img), Google Earth (.kml), OSM (.pbf), MAPS.ME (.mwm), OsmAnd (.obf) and MBTiles (.mbtiles). Map features and specific tags can either be selected through the Tag Tree or by configuring some YAML code. To learn more please, see the ‘Learn’ section at

hot export-tool


You can select your own area from any part of the world using the service at Disadvantages are that you aren’t able to select customizable tags and that the amount of data which you can download is limited.


Overpass is an API (Application Programming Interface) for extracting data from a read-only copy of the main OpenStreetMap database which can deliver an almost arbitrary amount of data. Using a query language you can customize which subset of the data you obtain. You can either use the API directly by generating a http-request or through the overpass turbo interface.

Overpass Turbo

Overpass Turbo is an interactive query generator where you should first zoom to the appropriate region on the map. Enter your query in the left field of the page and trigger any actions using the buttons at the top of the interface. If you are new to the query language then using the wizard should get you started. The OSM wiki contains a full description of the syntax of the query language as well as a collection of examples.

The map will highlight all data selected by your query which you can then modify. Press “Run” to refresh the result display. Once you are satisfied with what you see then “Export” offers a number of choices, among them raw OSM data. If the amount of data is limited you may as well access them directly after switching between map view and data view using the rightmost buttons at the top. The export option Query -> compact OverpassQL generates a hyperlink to be used for the Overpass API.

overpass turbo

If you want to engineer a fancy query in order to obtain a subset of the data from a large area then it is a good idea to test and improve this query in Overpass Turbo on a small area. You can then zoom out to your complete region of interest and use the resulting query url directly for the API. The next section explains how you can do this.

Overpass API

Overpass API is a dedicated service optimized for querying but not writing OpenStreetMap data. Due to this optimization it operates very fast compared to the main database api and has virtually no limits on the amount of data transferred. Several instances of this service are available on the net, the one used in the following example also provides some information on its homepage

If you have a working query-URL for submitting an http-request to the Overpass API then a tool such as wget - available for different operating systems, see here - allows you to download the raw OSM data directly from the server and store them locally. The following snippet is a script for the bash shell common on Unix systems which obtains all data within a specified bounding box:

echo lower left latitude
read ll_lat
echo lower left longitude
read ll_lon
echo upper right latitude
read ur_lat
echo upper_right longitude
read ur_lon
echo output file
read file
url="$ll_lat,$ll_lon,$ur_lat,$ur_lon);<;rel(br););out meta;"
wget -O $file "$url"

What happens here (for the curious who do not want to read the full query language documentation)?
node(…) selects all nodes within a bounding box;
< recurses up fully, i.e. selects all ways containing these nodes and all relations containing these nodes and ways;
rel(br) selects all parent relations of relations obtained so far (otherwise master relations would not be obtained)


The services mentioned in this chapter are all that the average user needs to get the OSM data they want and be able to work with it in GIS software. However, you may want to learn more powerful ways of working with the data yourself. The remaining chapters in this section are quite technical, but show more advanced methods of manipulating and accessing OSM data.

 Return to top of page

Official HOT OSM learning materials