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

I am trying to extract the whole world from OSM on the basis of administrative level (i.e, admin_level=2) using overpass turbo but it is difficult as it doesn't allow to download whole world at a single time. So please help me if you have any idea to export only countries boundary.

asked 29 Nov '16, 05:22

Ro%20Sun's gravatar image

Ro Sun
31224
accept rate: 0%

edited 29 Nov '16, 05:23


You can download the OSM planet file and filter out the admin boundaries (see this answer for example), or you could download from the boundaries map.

However, if you only want country boundaries then my suspicion is that you do not need the full detail that OSM offers (OSM data follows every smallest zig-zag of the boundary, resulting in very large polygons), and you might also dislike the fact the OSM boundaries don't hug the coastline but include the maritime claims as well. It might be much easier for you to head over to the public domain Natural Earth dataset which comes simplified for three different scales.

permanent link

answered 29 Nov '16, 06:44

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
82.5k927201273
accept rate: 23%

Here is the curl command to download the countries border

curl \
  --connect-timeout 10  \
  --retry 10  \
  --retry-delay 10  \
  --retry-max-time 500  \
  -H "Host: overpass-api.de" -H "Content-Type: text/xml"  \
  -d 'relation["admin_level"="2"];(._;>;); out body;'  \
  http://overpass-api.de/api/interpreter  \
  -o countries-border.osm

And use ogr2ogr to convert osm to shapefile.

permanent link

answered 30 Nov '16, 04:43

Gagan's gravatar image

Gagan
3053515
accept rate: 14%

edited 30 Nov '16, 04:46

Your answer
toggle preview

Follow this question

By Email:

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

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "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:

×26

question asked: 29 Nov '16, 05:22

question was seen: 6,957 times

last updated: 30 Nov '16, 04:46

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