I want to get the city boundaries within a specific country. The following query is fast but it's not bound to a country so that multiple city boundaries could be returned.
I tried this query but it's extremely slow:
Is there a better and faster solution? asked 21 Jun '18, 14:41 OsmStorm |
I've tried myself your slow query and it took me 90 seconds. Bear in mind that it hasn't the filter This one takes about 50 seconds, and does the same (it includes the
From my experience so far with Overpass, it takes normally a similar time for queries over a country of the size of Germany. But maybe somebody has a faster solution. answered 23 Jun '18, 17:23 edvac Thanks for your answer! But why is this query so much slower than the first one? The first one takes like 1-2 seconds compared to 50/90 seconds. I guess it would be faster to take one coordinate per polygon (city) and check via another query if it's inside the given country or not. If someone finds a faster query or any other faster solution, please let me know.
(26 Jun '18, 07:06)
OsmStorm
|
Is there maybe a way to detect which polygon belongs to which country by only going through the osm or geojson print? Maybe by help of the tags? Herne Germany:
Herne Belgium:
} But here, I could only take the wikipedia entry and decide by the prefix "de" / "nl" whereas "nl" would be wrong if I was looking for a Herne in the Netherlands. answered 26 Jun '18, 07:56 OsmStorm |
This should do it:
My understanding is that this line limits the query to just Germany:
Then this line does the actual search of all cities within that area:
If it's still too slow, you could run multiple queries - one for each State (which exist at admin level 4), based on this example for Brandenburg:
answered 08 Aug '19, 00:20 JamesChevalier |
crosspost: https://stackoverflow.com/questions/50967088/osm-overpass-api-get-city-boundaries-from-country-rate-limit