Overpass API – How to Get Street in City Using Overpass

openstreetmapoverpass-apioverpass-turbo

I'm trying to get all the nodes of one street in a district in Berlin.

I've written the following expression, but it returns all Holteistraße in Germany. Anyone know how I would write a correct syntax?

[out:json];

(
area["Berlin, Friedrichshain"];
way[highway][name="Holteistraße"];
);

out body;
>;
out skel qt;

Best Answer

Navigate to overpass-turbo.eu and enter the following the wizard popup:

highway=* and name=Holteistraße in Berlin

This will create the following query, which includes (area.searchArea) as a reference to the previously found area. Also, the area needs to match exactly the existing tagging of a way or relation. area["Berlin, Friedrichshain"]; would simply try to find a way/relation with the key "Berlin, Friedrichshain". Obviously, no such object exists.

/*
This has been generated by the overpass-turbo wizard.
The original search was:
“highway=* and name=Holteistraße in Berlin”
*/
[out:json][timeout:25];
// fetch area “Berlin” to search in
{{geocodeArea:Berlin}}->.searchArea;
// gather results
(
  // query part for: “highway=* and name="Holteistraße"”
  node["highway"]["name"="Holteistraße"](area.searchArea);
  way["highway"]["name"="Holteistraße"](area.searchArea);
  relation["highway"]["name"="Holteistraße"](area.searchArea);
);
// print results
out body;
>;
out skel qt;