Dividing areas


I am trying to get all roads in Bayern, using overpass api. I am sending requests via curl. Query I am using is this:

(areaname = “Bayern”;)->.searchArea;
out ids;

Since there are a lot of ways in Bayern, I am not able to retrieve any of them because of memory limit. I know I can use [maxsize:bytes], to increase memory limit, but then I get too many gateway_timeouts and I don’t want to rely on lucky time of the day when the server will say yes. I tried many things from filtering way[highway=“primary”] etc. however still the same thing.

I cannot even use “out count;” and do some workarounds, because the query just fails.

Obviously the area is too big. I got “Bayern” by using relations with admin_level = 4. So first thought is to use higher level, to get more smaller areas. Unfortunately, it does not work like that.

I only wanted to ask, if there exist some way of getting the area divided to smaller pieces, because the server is obviously loading everything in that area, even if I want only number of ways.

I’ve spent month developing program, that will get ways and categorize them to their respective roads, but it is all built around sending queries to server.

Today I found there exists, .pbf from geofabrik for the whole Europe. I could obviously do that, use osmium to extract data, but there is just too much work already done to throw it away.

TLDR: Can I somehow divide larger area into more, smaller areas?

Thank you.

It’s probably easier to download all the data for Bayern (see http://download.geofabrik.de/europe/germany/bayern.html ) and extract the roads you want from that.

Yes, I know about that option, I just didn’t want the work I’ve done be for nothing.

If you speak German (“Bayern” instead of “Bavaria”), you may go to the German forum: https://forum.openstreetmap.org/viewforum.php?id=14


Well, I think you have to face it. If you download an extract of Bavaria and filter all ways with highway=* using e.g. osmfilter you just need a small script to automate these two steps. If you invested a lot of work doing this with Overpass you went the wrong way and you work is of small - if any - use if you want to use it with huge areas.

There’s currently a limit in Overpass where nested area queries are not filtered, returning too many results. https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#By_area_.28area.29

“Caveat: area(area); is currently not supported. In this case, the (area) filter will be silently ignored, leading to unexpected results.”