Getting 406 and 504 Errors With Query Attempts

I’m querying all amenity=place_of_worship elements across the entire state of North Carolina, USA, to build a local database for an outreach tool I’m developing for Scouting.

I divided the state into 6 equal strips and query each strip with ~2 second delay between them. I’ve tried multiple changes to my requests, based on posts in this forum, but am still dealing with either 406 or 504 errors, depending on which endpoint I try.

I’m using .NET 9 HttpClient (via SocketsHttpHandler). I’m aware of the HTTP/2 ALPN issue with overpass-api.de and have already restricted ALPN to HTTP/1.1 on the handler. On kumi.systems the 406 still occasionally appears; on overpass-api.de I instead get 504. Neither mirror is reliably responding to the full-state query.

Here is the raw first request:

POST /api/interpreter HTTP/1.1
Host: overpass.kumi.systems
User-Agent: ScoutSchoolTracker/1.0 (scouting-org-tracker; contact@example.com)
Content-Type: application/x-www-form-urlencoded
Content-Length: 294

data=%5Bout%3Ajson%5D%5Btimeout%3A90%5D%3B%28node%5B%22amenity%22%3D%22place_of_worship%22%5D%2833.84%2C-84.320%2C36.59%2C-82.843%29%3Bway%5B%22amenity%22%3D%22place_of_worship%22%5D%2833.84%2C-84.320%2C36.59%2C-82.843%29%3Brelation%5B%22amenity%22%3D%22place_of_worship%22%5D%2833.84%2C-84.320%2C36.59%2C-82.843%29%3B%29%3Bout+center%3B

A different approach that might work would be to download an extract of North Carolina, and filter that with osmium.

That wouldn’t give the same errors, and would give you a file with whatever you have filtered for in it.

You can also output data in OPL (“one per line”) text format which makes further searching easy.

What would also work is postpass as an alternative to overpass.

2 Likes

I didn’t know these extracts existed- I’ll start there and see if that meets the project’s needs. Thanks! I’ll mark as answered if that fixes the issue.