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

Yuri Astrakhan yuriastrakhan at gmail.com
Wed Aug 14 14:41:07 UTC 2019


You can use Sophox to pull this type of information, possibly just not all
at once.

Here's a query that will give you all first level country sub-divisions
(Canada in this case), as well as each province's Captial, Flag image, and
ISO codes.

https://tinyurl.com/y6jowy8v

(this query was modified from one of the examples Sophox has)

On Tue, Aug 13, 2019 at 5:47 PM Léo El Amri via talk <talk at openstreetmap.org>
wrote:

> Hello,
>
> 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 ?)
>
> Cordially,
> Léo
>
> _______________________________________________
> talk mailing list
> talk at openstreetmap.org
> https://lists.openstreetmap.org/listinfo/talk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/talk/attachments/20190814/a04f04fa/attachment.html>


More information about the talk mailing list