- 00 - The Beginning
- 01 - Finding nodes with a bounding box
- 02 - Outputting data about nodes
- 03 - Filtering nodes that have a tag
- 04 - Find nodes by matching tags and their values
- 05 - Find nodes by applying multiple filters
- 06 - Extracting multiple sets of nodes
- 07 - Calculating differences between results
- 08 - Generating JSON output
- 09 - Generating CSV output
- 10 - The default set
- 11 - Querying a set
- 12 - Searching within a radius using around
- 13 - Using around to filter against a set of results
- 14 - Searching by polygon
- 15 - Finding ways
- 16 - Ways and their nodes
- 17 - Ways and their tags
- 18 - Combining node and way queries
- 19 - Finding ways from their nodes
- 20 - Finding relations
- 21 - Type agnostic queries (nwr)
- 22 - Areas
- 23 - Finding the areas enclosing a feature
- 24 - Find the area derived from a feature
- 25 - Areas via Nominatim search
- 26 - Timeouts and endpoints
14 - Searching by polygon
OverpassQL supports searching for features within a polygon defined by a collection of points.
poly filter accepts a single parameter. This must be a string value that
contains an even number of latitude and longitude pairs. Collectively these
coordinates should define a closed shape on the map.
This polygon is then used as the boundary for the query.
This query extracts nodes that can be found within a polygon that covers an area to the west of Uluṟu.
There isn't a default bounding box defined in this query, as our area of
interest is fully described by the
Note there's some quirks around syntax here which make
poly slightly different to
- the parameter MUST be provided as a quoted string.
- the coordinate values MUST be separated by spaces and not commas.
The syntax for the
around filter is different.
poly filter doesn't support querying based
on a polygon that was found by a previously extracted set of nodes.
So you can't, for example, extract the polygon describing a closed way stored in OpenStreetMap and then search within it. This feels like an oversight, but we'll see how to do this type of query later in the tutorial.
Tip: the more complex your polygon, the slower the search. Simplify the boundary to improve performance.