enter image description here

I'm trying to extract the Jordanian country border from an OpenStreetMap. When I click the download link for the file, the following page opens:

enter image description here

How do I save these XML tags as an XML- or OSM file which I can convert into a shapefile, so that I can use it in QGIS?

  • 1
    Its already in XML, and QGIS can use OSM already. Have you already looked at Natural Earth as a source of country borders? Have you looked at the Overpass API? – BradHards Jan 29 '15 at 6:49

If you want to convert it to a Shapefile just download the xml (for example right-mouse-click on the download link and choose something like "save target as..." instead of opening it in the browser. then in Qgis choose "add vectorlayer" or use drag and drop to add your xml layer to your Qgis project. then save layer as shapefile. If you are just looking for the borders and it does not have to be OSM you could also have a look at http://gadm.org


There is a service that allows you to retrieve any administrative border from OpenStreetMap in a number of formats. https://osm.wno-edv-service.de/boundaries/

  • thank you, your answer is very useful, I really appreciate what you are doing – user3368456 Feb 1 '15 at 7:00
  • This link is now dead, sadly. – Bing Jan 4 '17 at 18:04
  • The application says, it's available here now: wambachers-osm.website/boundaries – ulrich Dec 1 '17 at 10:18
  • I used that service, but it's down :-( Will add another comment more lower – Jachym Jun 12 '20 at 6:24

If you wish to retrieve the OSM Raw XML, that is how Overpass API query would look like:

http://www.overpass-api.de/api/interpreter?data=[bbox];(way[admin_level="2"];way[border_type="nation"];);(._;>;);out body qt;&bbox=112.5,31.9521,123.75,40.9798

Please replace that &bbox=112.5,31.9521,123.75,40.9798 with coordinates of the region of your interest.


The most simple query I came with using Overpass turbo https://overpass-turbo.eu/ is

out geom;

With list of administrative levels for each country from List of the levels for each country: https://wiki.openstreetmap.org/wiki/Tag:boundary=administrative

Result can be downloaded as GeoJSON.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.