westnordost / osmapi-overpass

Java client for the Overpass API
GNU Lesser General Public License v3.0
17 stars 0 forks source link

Overpass APIs - read timeout #5

Closed padmalcom closed 11 months ago

padmalcom commented 11 months ago

Hi @westnordost, first of all thanks for your fantastic library.

I implemented a simple demo but I couldn't get a connection to the overpass API server (https://overpass-api.de/api/). I tried several servers, listed here: https://wiki.openstreetmap.org/wiki/Overpass_API

But I couldn't get a connection to any of them, I get a "SocketTimeoutException: read timeout".

westnordost commented 11 months ago

Hm well, this doesn't seem to be related to the library. A socket timeout means that a timeout has occurred on a socket read or accept and could have various reasons, none concern this library. I do not operate any of these servers and don't know how they behave nor do I manage your network setup. If you are sure this is nothing about your network, I suggest you read the FAQ or alike on the individual servers, maybe you are required to supply certain information in the request or something.

padmalcom commented 11 months ago

Thanks for the fast reply, I forgot to metion that https://overpass-api.de/api/ returns a 403 forbidden. My thoughts were that the URL syntax changed.

jmizv commented 4 months ago

What worked for me was increasing the timeout when creating the OSMConnection:

return new OsmConnection(
                "https://overpass-api.de/api/",
                "AmazingUserAgentButBetterUseYourOwn",
                null,
                240_000);

The 45 seconds default timeout raised a SocketTimeout with a query that had no elements as result. 🤷

PS: Thanks Tobias for the great work 🎉