[OSM-talk] Overpass API - Fetching countries, their capitals, and their borders

Michael Reichert osm-ml at michreichert.de
Wed Aug 14 12:10:26 UTC 2019


Am 13/08/2019 um 23.41 schrieb Léo El Amri via talk:
> I'm trying to fetch countries, their borders, and their capitals through
> Overpass API, but the server never replies to me (With a timeout:3600
> setting, the server reply with a 502 error after a while).
> I'm only a beginner with this API, so maybe my request is not efficient:
> (
>   node[place=city];
>   node[place=town];
> )->.a;
> rel[boundary=administrative][admin_level=2]->.b;
> (
>   node[place=country];
>   node.a[capital=yes];
>   way[boundary=administrative][admin_level=2];
>   .b;
>   .b >;
> )->.o;
> .o out body;
> What am I doing wrong ? (Should I use another tool for this purpose ?)

That's a lot of data.

Download the planet dump in .osm.pbf format from
planet.openstreetmap.org or a regional extract from
download.geofabrik.de and use Osmium's tags-filter command.

Depending on your goal, it might be sensible do to a rough filtering
with Osmium and then import the OSM file into a PostgreSQL database
using Osm2pgsql.

Best regards


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.openstreetmap.org/pipermail/talk/attachments/20190814/4ecb69d9/attachment.sig>

More information about the talk mailing list