[OSM-talk] How to extract national borders?

Roland Olbricht roland.olbricht at gmx.de
Sat May 29 07:14:05 BST 2010


> What's the best way to get an OSM file with the national borders?
>
> I tried using XAPI to look for "../*[admin_level=2]", or
> ".../*[admin_level=2][boundary=administrative]" or
> "relation[admin_level=2]", but all took so long that I stopped them and
> were producing OSM files that were hunderds of MB big. So I wonder if
> I'm doing something wrong, or if there is a better way.

You are tying to get all the nation boundary data from all over the world with 
this query. This *is* that much data.

You can try to send

<osm-script timeout="180">

<query type="relation">
  <has-kv k="admin_level" v="2"/>
  <has-kv k="name" v="Ireland"/>
</query>
<union>
  <item/>
  <recurse type="relation-way"/>
  <recurse type="way-node"/>
</union>
<print mode="body"/>

</osm-script>

to http://78.46.81.38/interpreter/ .
You can do this as follows
- go to http://78.46.81.38/ and paste the above into one of the text fields.
- use wget: save the above to a file "foo.txt" and run
wget -O - --post-file=foo.xml http://78.46.81.38/api/interpreter | gunzip 
>foo.osm
(command in a single line)

Cheers,

Roland




More information about the talk mailing list