Overpass Tutorial
- 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
08 - Generating JSON output
When you're viewing results in the Overpass Turbo IDE it'll show your results on a map.
Or at least it will if you have used an out
option that produces some geometry.
But you can always see the raw data by clicking on the "Data" tab.
By default the Overpass API returns XML. But it can also produce JSON output.
To request that you need to use the out
query setting. Confusingly this has the
same name as the keyword used to generate results in different level of details,
but they perform different roles and appear in different parts of a query.
[out:xxx]
is a query setting that specifies the format of the data. It appears at the start of a queryout
is a statement that is used to control how much data is included in the results. It appears in the body of a query.
The JSON output is a custom format. It's not GeoJSON but isn't hard to convert to that format.
If you're using the Overpass Turbo application then the "Export" menu offers the option to do this conversion for you. This is downloaded directly from the application. You can't request GeoJSON directly from the API.
Links | |
Source File | 08-nodes-json-output.osm |
Authors |
|