Hi, I am sending this type of requests to Overpass API (http://overpass-turbo.eu/s/8p9):
It retrieves ways around a certain set of lat/lon. And it works well as long as the number of results is reasonable. Otherwise, the timeout is reached quite easily. For this particular example, the limit seems to be 383 elements in the returned object. I only need the end nodes's coordinates, i.e. Cheers asked 24 Mar '15, 20:59 agaudin |
If your app can handle partial results, you could introduce several Another strategy could be to split your area into several smaller chunks and load them one by one. First results are available very early so your user won't have to wait for 10+ seconds for a first glimpse of a way. Currently, there's no way to take the length of a way into account, so filtering by "short" or "long" ways is not possible. answered 28 Mar '15, 10:37 mmd |
What's the problem with enlarging the timeout? A 5 km radius is about 78.5 kmĀ². In a city, there's quite a lot of data in there.
The example you give seems to return about 2MB of data, which is too much for a 7 seconds timeout.
One thing I could propose is to avoid the regex. It's perfectly possible to put that query in a union instead of with a regex. But that still won't make it faster than 7 seconds. Also sorting the output per quadtile won't help enough.
This code is meant to be part of an app and I don't want the user to wait for too long (<7 seconds). Yes, I am aware of the size returned, that's why I want to exclude unuseful elements. If need be, I'd be fine if the API returns all the elements found during the timeout instead of returning an error if not finished. Is that possible?
Thanks for your advice on the request using unions and quadtile sorting. I'm gonna try this.