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

Wayne Emerson, Jr. ibemerson at verizon.net
Wed Aug 14 02:40:21 UTC 2019


Yes I agree that every country's borders on earth adds up to a lot of 
data. And my last reply could have been clearer. If you look at his 
original query (which is mangled now by the email), He was looking for 
the NODES of each country's capital city, not the city borders.?? And 
although the Argentina relation may only have 2 nodes in the relation, 
there are apparently 80 other city nodes there tagged with 
admin_level=2, which seems like bad tagging.

On 8/13/2019 10:21 PM, Warin wrote:
> On 14/08/19 11:39, Wayne Emerson, Jr. via talk wrote:
>> He wasn't asking for every town on earth. Just every country's 
>> border, and every country's capitol. I am a noob too so can't answer 
>> his question. But I did run the wizard with "admin_level=2 and 
>> type:node" and got 3,988 nodes. Which begs the question, why does 
>> Argentina have dozens of admin level 2 nodes? I am guessing around 80 
>> or so.
>
> Each border would usually be a relation with a number of ways. Each 
> way will have a number of nodes to make the way.
>
>
> Example
> Argentina is relation 286393
>
> https://www.openstreetmap.org/relation/286393#map=4/-40.51/-63.63
>
> It has 2 nodes, many ways and a number of separate relations... look 
> at teh above link.
>
> One of those ways is Way: Border Chile - Argentina (206446254) and 
> that single way has 393 nodes.
>
>>
>> On 8/13/2019 6:30 PM, Warin wrote:
>>> On 14/08/19 07:41, L??o El Amri via talk 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];
>
> this gets all cities?
>>>> ???? node[place=town];
> this gets all towns?
>>>> )->.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 ?)
>>>>
>>>
>>> Too much data? So it times out.
>>>
>>> You are asking for every node of;
>>>
>>> city 19,930
>>>
>>> town 111,981
>>>
>>> country 221
>>>
>>> And then boundaries as well. 29,752
>>>
>>> The numbers I got from taginfo.. did not bother with separating 
>>> nodes etc.
>>>
>>> I think the boundaries will cause problems - lots of nodes and ways 
>>> in there as well as the relations.
>>>
>>> Suggestions? Do it in small sections.
>>>
>>> Get the cities and countries as one item and see if that works. Save 
>>> the result for later merging.
>>>
>>> Get the boundaries for a small section of the world .. with few 
>>> boundaries and see if that works.
>>>
>>>
>>>
>
>
> _______________________________________________
> talk mailing list
> talk at openstreetmap.org
> https://lists.openstreetmap.org/listinfo/talk




---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/talk/attachments/20190813/ef73ccf8/attachment-0001.html>


More information about the talk mailing list