Reputation: 5106
I want to get all streets in NYC using http://overpass-turbo.eu/. I tried this:
[out:json]; area[name = "New York"]; (node(area)[highway=street]; ); out;
However it returns
{
"version": 0.6,
"generator": "Overpass API 0.7.55.1009 5e627b63",
"osm3s": {
"timestamp_osm_base": "2019-11-13T19:26:03Z",
"timestamp_areas_base": "2019-11-13T18:05:02Z",
"copyright": "The data included in this document is from www.openstreetmap.org. The data is made available under ODbL."
},
"elements": [
]
}
No elements. However this query:
[out:json]; area[name = "New York"]; ( node(area)[amenity=cinema]; node(area)[highway=street]; ); out;
for getting streets and cinemas, works:
{
"version": 0.6,
"generator": "Overpass API 0.7.55.1009 5e627b63",
"osm3s": {
"timestamp_osm_base": "2019-11-13T19:29:02Z",
"timestamp_areas_base": "2019-11-13T18:05:02Z",
"copyright": "The data included in this document is from www.openstreetmap.org. The data is made available under ODbL."
},
"elements": [
{
"type": "node",
"id": 344994897,
"lat": 41.7680892,
"lon": -73.9291000,
"tags": {
"amenity": "cinema",
"created_by": "Potlatch 0.10f",
"name": "Roosevelt Theater"
}
},
...
How should I modify the initial query to get the streets?
Upvotes: 3
Views: 3874
Reputation: 21469
There are two errors in your query.
Where does this tag come from? street
is not a valid value for the highway
key. In fact, since you want to obtain all streets you have to omit the value completely and just query for highway
.
A road is not a node but a way. So you have to query for way(area)[...]
instead. This also requires a recurse-up step (>;
) to retrieve all nodes of these ways.
[out:json]; area[name = "New York"]; (way(area)[highway]; ); (._;>;); out;
Upvotes: 6