12 - Searching within a radius using around

OverpassQL allows us to perform some basic spatial queries.

We've already explored various ways to query for nodes within a bounding box.

We can also search for nodes or other features that can be found within a circular area using the around filter.

This filter uses curved brackets (()). Only tag filters use square brackets ([]).

The simplest form of this filter accepts a distance (in meters) and a latitude and longitude. This point and distance describe the centre of a circle and its radius.

The results are then filtered to features that are within that search area.

This example query finds nodes tagged as caves that are within 800m of the peak of Uluṟu. There is a single result, which is a cave called Tjilpi Pampa Kulpi.

Notice that we don't define a bounding box for this particular query. Our area of interest is specified by the around filter.

There are more complex ways that we can use the around filter.

Instead of searching within a circle, we can instead query for nodes that can be found near to a line. To use this variant, we would need to specify multiple latitude/longitude pairs that define the line we are interested in. An example is shown in the query for you to try.

An even more useful version of around is shown in the next example.

Source File12-radius-search.osm
Authors
  • Leigh Dodds