NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

Hello Dear All,

I would like to export a .osm file in which only the Motorways (which are shown in red in open street map) are available for a whole small country like Belgium.

How can I export the above-mentioned file from the open street map?

Thank you all in advance for helping me with this issue.

Regards, Behzad

asked 02 Apr '20, 10:48

Behzad's gravatar image

accept rate: 0%

To expand on your additional question (How can I add other elements (for instance: railways)!?):

Objects in OSM are attributed by a main tag. For any sorts of highways that is highway=, e.g. you have seen highway=motorway and highway=motorway in the Overpass queries now. Other useful main tags you might be interested in are railway= and waterway=. If you look at the linked pages you find the mostly used values for these tags. I suppose you can change the Overpass query yourself. For other types of objects just search around on the OpenStreetMap Wiki.

Maybe worth noting that sometimes these features are not mapped as simple lines but as multipolygons. Then you would have to query not only for way["highway"="xyz"] but also for relation["highway"="xyz"]. I don't expect this to happen much for these kind of features, though.

permanent link

answered 03 Apr '20, 10:30

TZorn's gravatar image

accept rate: 15%

Thank you again dear TZorn, I tried to make some modification in the quarry that you provided and I come up with the above error:

"An error occured during the execution of the overpass query! This is what overpass API returned: Error: runtime error: […] Please check /api/status for the quota of your IP address."

Besides, is it possible to indicate a specific speed limit for a highway type?

(03 Apr '20, 14:58) Behzad

There are some limits on usage so not to overload the servers. Best contact the server maintainers to find out more (if no one reading here knows more than me).

(03 Apr '20, 17:06) TZorn

Thank you very much

(06 Apr '20, 08:50) Behzad

That's because you're downloading 60mb each time you run it. Try this:

[bbox:{{bbox}}]; way[highway~"^(motorway|motorway_link|primary)$"]; out geom;

bbox limits the output to the size of your window. out:xml isn't really required as it's converted when you export it as raw OSM data.

(09 Apr '20, 15:18) DaveF

You can run this Overpass query in OverpassTurbo (the link takes you there). Then press Run (or Execute, I have the UI in Dutch). Then click Export and choose the format you need.

permanent link

answered 02 Apr '20, 13:50

escada's gravatar image

accept rate: 21%


You might want to add highway=motorway_link to also fetch the interlinks of crossing motorways if you need those. It will also give you the ramps on/off the motorway, though. In the end you might need to do some cleaning.

(02 Apr '20, 14:37) TZorn

Thank you very much for providing the links. it is very healful.

  • I cannot export an.OSM file. How can I do so?
  • what if I want two maps? One that includes only Motorways and the other one includes motorways (Shown in red) and Main roads (shown in yellow)?
(02 Apr '20, 14:38) Behzad

To be able to export to OSM format we need the query result in xml. Try the updated query. I also added lines to include motorway links and primary highways.

This extract could become huge. So watch out when trying to run it (I didn't). You can remove the respective lines again if you want.

(02 Apr '20, 15:27) TZorn

Dear TZom, Thank you very much. I really appreciate your favor. This is exactly what I want!

Besides, How can I add other elements (for instance: railways)!? Regards,

(03 Apr '20, 10:11) Behzad

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 02 Apr '20, 10:48

question was seen: 1,798 times

last updated: 09 Apr '20, 15:18

NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum