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

2019-08-14 Thread Warin

Rather than do a planet wide dump I would encourage you to do a smaller area 
dump so you get a smaller sample to test first?



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];
   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@openstreetmap.org
https://lists.openstreetmap.org/listinfo/talk




___
talk mailing list
talk@openstreetmap.org
https://lists.openstreetmap.org/listinfo/talk


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

2019-08-14 Thread Léo El Amri via talk
I was doing a query for all city and towns before doing a query of all
"capital=yes" in this set. This was only the result of the interserction
that was sent to the output.

I didn't really knew how to "OR" the filters. Now I see, and your
solution looks better :)

On 14/08/2019 14:51, Dave F via talk wrote:
> This may help for future routines, if not this one:
> 
> nwr[place~"city|town"][capital=yes][admin_level=2]->.Capitals;
> .Capitals out center;
> 
> in your original you were initially searching *all* of the world's towns
> & cities instead of 194 capitals. (OSM appears to be missing one)
> 
> It'll need checking but I think all capital cities should be returned as
> members in the set of boundary relations with the role of 'admin_centre'.
> 
> https://overpass-turbo.eu/s/Lwe
> 
> [bbox:{{bbox}}];
> rel[boundary=administrative][admin_level=2];
> nwr(r:admin_centre);
> out center;
> 
> You appear to be outputting both boundary relations & ways which seems a
> bit pointless
> This returns all ways within the relations:
> https://overpass-turbo.eu/s/Lwk
> 
> [bbox:{{bbox}}];
> rel[boundary=administrative][admin_level=2];
> way(r._);
> out geom;
> 
> HTH
> DaveF.
> 
>> On 13/08/2019 23: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];
>>>    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@openstreetmap.org
https://lists.openstreetmap.org/listinfo/talk


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

2019-08-14 Thread Yuri Astrakhan
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 
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@openstreetmap.org
> https://lists.openstreetmap.org/listinfo/talk
>
___
talk mailing list
talk@openstreetmap.org
https://lists.openstreetmap.org/listinfo/talk


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

2019-08-14 Thread wambacher
Hi Léo,

ok, if you need raw data you should ask for "raw data" and not
"countries, their capitals, and their boundaries" :(
> In the end, I'm sure I'll need at least all countries of the world up to
> the admin level 2 (With their capitals, if they have one (And aren't one
> themselves)) and all the data associated with them on OSM.

Ok, then you have to use a full planet database - which is no easy job,
because you will need much cpu power, disk space, memory and experience.

Bye

walter

-- 
My projects:

Admin Boundaries of the World 
Missing Boundaries

Emergency Map 
Postal Code Map (Germany only) 
Fools (QA for zipcodes in Germany) 
Postcode Boundaries of Germany 
OSM Software Watchlist

___
talk mailing list
talk@openstreetmap.org
https://lists.openstreetmap.org/listinfo/talk


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

2019-08-14 Thread Dave F via talk

This may help for future routines, if not this one:

nwr[place~"city|town"][capital=yes][admin_level=2]->.Capitals;
.Capitals out center;

in your original you were initially searching *all* of the world's towns 
& cities instead of 194 capitals. (OSM appears to be missing one)


It'll need checking but I think all capital cities should be returned as 
members in the set of boundary relations with the role of 'admin_centre'.


https://overpass-turbo.eu/s/Lwe

[bbox:{{bbox}}];
rel[boundary=administrative][admin_level=2];
nwr(r:admin_centre);
out center;

You appear to be outputting both boundary relations & ways which seems a 
bit pointless

This returns all ways within the relations:
https://overpass-turbo.eu/s/Lwk

[bbox:{{bbox}}];
rel[boundary=administrative][admin_level=2];
way(r._);
out geom;

HTH
DaveF.

On 14/08/2019 09:29, Léo El Amri via talk wrote:

Hi again,

Thanks for the replies

I did several other tries this morning, but it looks like the borders
are too much to handle. Taking your answers into account, rather than
doing thousands of queries on the Overpass API, I think I'll get the
whole Planet file, then use a local tool to get the data (Anyways, in
this context, I only need this info occasionally).

Cordially,
Léo

On 13/08/2019 23: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];
   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@openstreetmap.org
https://lists.openstreetmap.org/listinfo/talk


___
talk mailing list
talk@openstreetmap.org
https://lists.openstreetmap.org/listinfo/talk



___
talk mailing list
talk@openstreetmap.org
https://lists.openstreetmap.org/listinfo/talk


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

2019-08-14 Thread Léo El Amri via talk
On 14/08/2019 13:11, wambac...@posteo.de wrote:
> did you read my mail? My website is made for that, believe me.
> 
> What do you need? Which countries? Up to which admin level? Which format
> (shp? json?)

Hi Walter,

Yes, I visited your website this morning. It is interesting on a
"analytic/analysis" stand-point, but in my case I'll have to do some
post-processing on the raw data and the definition of the project is not
yet set, so I'd prefer an in-house tool with full control on the
source-code and process of extraction.

In the end, I'm sure I'll need at least all countries of the world up to
the admin level 2 (With their capitals, if they have one (And aren't one
themselves)) and all the data associated with them on OSM.

Cordially,
Léo

___
talk mailing list
talk@openstreetmap.org
https://lists.openstreetmap.org/listinfo/talk


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

2019-08-14 Thread Michael Reichert
Hi,

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

Michael




signature.asc
Description: OpenPGP digital signature
___
talk mailing list
talk@openstreetmap.org
https://lists.openstreetmap.org/listinfo/talk


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

2019-08-14 Thread Warin



You have set the "reply to" on your outgoing messages such that replies 
go to you and not this list.


That means the list is not aware of the replies and cannot make comments 
on them. This hinders understanding and communication.



It is better that replies go to the list where all can read them.

___
talk mailing list
talk@openstreetmap.org
https://lists.openstreetmap.org/listinfo/talk


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

2019-08-14 Thread wambacher
Hi Léo,

did you read my mail? My website is made for that, believe me.

What do you need? Which countries? Up to which admin level? Which format
(shp? json?)

Regards

walter

-- 
My projects:

Admin Boundaries of the World 
Missing Boundaries

Emergency Map 
Postal Code Map (Germany only) 
Fools (QA for zipcodes in Germany) 
Postcode Boundaries of Germany 
OSM Software Watchlist

___
talk mailing list
talk@openstreetmap.org
https://lists.openstreetmap.org/listinfo/talk


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

2019-08-14 Thread Léo El Amri via talk
Hi again,

Thanks for the replies

I did several other tries this morning, but it looks like the borders
are too much to handle. Taking your answers into account, rather than
doing thousands of queries on the Overpass API, I think I'll get the
whole Planet file, then use a local tool to get the data (Anyways, in
this context, I only need this info occasionally).

Cordially,
Léo

On 13/08/2019 23: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];
>   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@openstreetmap.org
> https://lists.openstreetmap.org/listinfo/talk
> 

___
talk mailing list
talk@openstreetmap.org
https://lists.openstreetmap.org/listinfo/talk


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

2019-08-14 Thread wambacher
Hi Léo

Am 13.08.19 um 23:41 schrieb Léo El Amri via talk:
> Hello,
>
> I'm trying to fetch countries, their borders, and their capitals through
> Overpass API, but the server never replies to me ...

https://wambachers-osm.website/boundaries will give you the country
borders - including the *osm id of the admin center*, which is usually
the capital. In a second step you may download the capitals via overpass.

Better than nothing ;)

Regards
walter
-- 
My projects:

Admin Boundaries of the World 
Missing Boundaries

Emergency Map 
Postal Code Map (Germany only) 
Fools (QA for zipcodes in Germany) 
Postcode Boundaries of Germany 
OSM Software Watchlist

___
talk mailing list
talk@openstreetmap.org
https://lists.openstreetmap.org/listinfo/talk


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

2019-08-13 Thread Wayne Emerson, Jr. via talk
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@openstreetmap.org
https://lists.openstreetmap.org/listinfo/talk





---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
___
talk mailing list
talk@openstreetmap.org
https://lists.openstreetmap.org/listinfo/talk


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

2019-08-13 Thread Warin

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@openstreetmap.org
https://lists.openstreetmap.org/listinfo/talk


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

2019-08-13 Thread Wayne Emerson, Jr. via talk
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.


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];
 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 ?)



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@openstreetmap.org
https://lists.openstreetmap.org/listinfo/talk




---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus


___
talk mailing list
talk@openstreetmap.org
https://lists.openstreetmap.org/listinfo/talk


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

2019-08-13 Thread Warin

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];
   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 ?)



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@openstreetmap.org
https://lists.openstreetmap.org/listinfo/talk


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

2019-08-13 Thread Léo El Amri via talk
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@openstreetmap.org
https://lists.openstreetmap.org/listinfo/talk