Skip to content
This repository was archived by the owner on Jun 10, 2025. It is now read-only.

Commit 7804c87

Browse files
authored
Merge pull request #146 from mvexel/doc-csv-update
documentation update to clarify CSV output
2 parents a9f265f + 613def0 commit 7804c87

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,25 @@ You can set the response type of your query using `get()`'s `responseformat` par
9595
response = api.get('node["name"="Salt Lake City"]', responseformat="xml")
9696
```
9797

98+
If you choose `csv`, you will need to specify which fields you want, as described [here](https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#CSV_output_mode) in the Overpass QL documentation. An example:
99+
100+
```python
101+
response = api.get('node["name"="Springfield"]["place"]', responseformat="csv(name,::lon,::lat)")
102+
```
103+
104+
The response will be a list of lists:
105+
106+
```python
107+
[
108+
['name', '@lon', '@lat'],
109+
['Springfield', '-3.0645656', '56.2952787'],
110+
['Springfield', '0.4937446', '51.7487585'],
111+
['Springfield', '-2.4194716', '53.5732892'],
112+
['Springfield', '25.5454526', '-33.9814866'],
113+
....
114+
]
115+
```
116+
98117
#### `build`
99118

100119
We will construct a valid Overpass QL query from the parameters you set by default. This means you don't have to include 'meta' statements like `[out:json]`, `[timeout:60]`, `[out body]`, etcetera. You just supply the meat of the query, the part that actually tells Overpass what to query for. If for whatever reason you want to override this and supply a full, valid Overpass QL query, you can set `build` to `False` to make the API not do any pre-processing.

0 commit comments

Comments
 (0)