You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note that the Overpass query passed to `get()` should not contain any `out` or other meta statements.
61
+
**Note that the Overpass query passed to `get()` should not contain any `out` or other meta statements.** See `verbosity` below for how to control the output.
29
62
30
63
Another example:
31
64
@@ -38,41 +71,34 @@ Another example:
38
71
39
72
You can find more examples in the `examples/` directory of this repository.
40
73
41
-
### Response formats
74
+
The `get()` method takes a few parameters, all optional having sensible defaults.
42
75
43
-
You can set the response type of your query using `get()`'s `responseformat` parameter to GeoJSON (`geojson`, the default), plain JSON (`json`), CSV (`csv`), and OSM XML (`xml`).
76
+
#### `verbosity`
44
77
45
-
```python
46
-
response = api.get('node["name"="Salt Lake City"]', responseformat="xml")
47
-
```
48
-
49
-
### Parameters
50
-
51
-
The API object takes a few parameters:
52
-
53
-
#### `endpoint`
54
-
55
-
The default endpoint is `https://overpass-api.de/api/interpreter` but
56
-
you can pass in another instance:
78
+
You can set the verbosity of the [Overpass query `out` directive](https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#out) using the same keywords Overpass does. In order of increased verbosity: `ids`, `skel`, `body`, `tags`, `meta`. As is the case with the Overpass API itself, `body` is the default.
57
79
58
80
```python
59
-
api = overpass.API(endpoint=https://overpass.myserver/interpreter)
81
+
>>>import overpass
82
+
>>> api = overpass.API()
83
+
>>> data = api.get('way(42.819,-73.881,42.820,-73.880);(._;>;)', verbosity='geom')
84
+
>>> [f for f in data.features if f.geometry['type'] =="LineString"]
60
85
```
61
86
62
-
#### `timeout`
87
+
(from [a question on GIS Stackexchange](https://gis.stackexchange.com/questions/294152/getting-all-information-about-ways-from-python-overpass-library/294358#294358))
63
88
64
-
The default timeout is 25 seconds, but you can set it to whatever you
65
-
want.
89
+
#### `responseformat`
90
+
91
+
You can set the response type of your query using `get()`'s `responseformat` parameter to GeoJSON (`geojson`, the default), plain JSON (`json`), CSV (`csv`), and OSM XML (`xml`).
66
92
67
93
```python
68
-
api=overpass.API(timeout=600)
94
+
response=api.get('node["name"="Salt Lake City"]', responseformat="xml")
69
95
```
70
96
71
-
#### `debug`
97
+
#### `build`
72
98
73
-
Setting this to `True` will get you debug output.
99
+
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.
74
100
75
-
### Simple queries
101
+
### Pre-cooked Queries: `MapQuery`, `WayQuery`
76
102
77
103
In addition to just sending your query and parse the result, `overpass`
78
104
provides shortcuts for often used map queries. To use them, just pass
0 commit comments