mjd
mjd

Reputation: 119

Overpass QL: Possibility to set "around" globally like bounding box (bbox)

I'm trying to use the Overpass Api to get information from OpenStreetMap around my current position via Get. Using a Bounding Box it works:

https://overpass-api.de/api/interpreter?data=[timeout:25][out:json];(way[%22amenity%22=%22hospital%22][%22emergency%22=%22yes%22](bbox);relation[%22amenity%22=%22hospital%22][%22emergency%22=%22yes%22](bbox);way[%22amenity%22=%22fire_station%22](bbox);relation[%22amenity%22=%22fire_station%22](bbox););out%20geom;&bbox=westlimit,southlimit,eastlimit,northlimit

Now I have the problem that I only know the current Coordinates (latitude, longitude). And I want to query around 10'000m around this Coordinates.

I know there is around. This would be the QL for that query:

[out:json][timeout:25];
(
  way["amenity"="hospital"]["emergency"="yes"](around:10000,latitude,longitude);
  relation["amenity"="hospital"]["emergency"="yes"](around:10000,latitude,longitude);
 way["amenity"="fire_station"](around:10000,latitude,longitude);
  relation["amenity"="fire_station"](around:10000,latitude,longitude);
);
// print results
out geom;

I want to use the GET Endpoint of the API As you can see the around parameter is repeating.

Is it possible to set it globally, like the bbox above?

Upvotes: 0

Views: 573

Answers (1)

mmd
mmd

Reputation: 3678

No, that's not possible, you cannot define "around" on a global level.

There's been an enhancement request to shorten the query a bit by having one "wr" instead of one "way" and another "relation" query. At the time of writing, this isn't available yet.

See https://github.com/drolbr/Overpass-API/issues/535 for more details.

Upvotes: 1

Related Questions