OpenStreetMap – Correct Overpass-Turbo Query for All City Streets

openstreetmapoverpass-apioverpass-turbo

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"
  }
},
{
  "type": "node",
  "id": 344996199,
  "lat": 41.7727941,
  "lon": -73.9292159,
  "tags": {
    "amenity": "cinema",
    "created_by": "Potlatch 0.10f",
    "name": "Hyde Park Drive-In"
  }
},
{
  "type": "node",
  "id": 368043485,
  "lat": 40.7259416,
  "lon": -73.9973321,
  "tags": {
    "addr:state": "NY",
    "amenity": "cinema",
    "ele": "10",
    "gnis:county_name": "New York",
    "gnis:feature_id": "2082840",
    "gnis:import_uuid": "57871b70-0100-4405-bb30-88b2e001a944",
    "gnis:reviewed": "no",
    "name": "Angelika Film Center",
    "source": "USGS Geonames",
    "wikidata": "Q45104731"
  }
},
...

How should I modify the initial query to get the streets?

EDIT:

I tried

[out:json];
area[name = "New Hampshire"]->.a;          // Redirect result to ".a"
out body qt;
(
  way
    (area.a)                    // Use result from ".a"
    ["highway"="living_street"];
);
out body qt;
>;
out skel qt;

but it didn't select all of the streets, just several. And how should I specify that I mean a state by New Hampshire? I need all streets with postcodes (zip).

this doesn't display any streets at all:

[out:json];
area[name = "Acworth"]->.a;          // Redirect result to ".a"
out body qt;
(
  way
    (area.a)                    // Use result from ".a"
    ["highway"="living_street"];
);
out body qt;
>;
out skel qt;

Although it should at least display these: https://geographic.org/streetview/usa/nh/sullivan/acworth.html

Best Answer

You can use a regular expression to combine several highway=* queries into a single one.

[out:json];
area[name = "New York"];
(way(area)["highway"~"^(motorway|trunk|primary)$"];>;);
out;

Note: this query returns more than 40 MB worth of data.

NB: Be sure to review https://help.openstreetmap.org/questions/20531/overpass-ql-nodes-and-ways-in-area when using multiple query statements for the same area.