This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

overpass query addresses near a street with the same name and a special tag

0

For a mapping project we have identified a large number of streets that are about to change names.
So they are easy to query (this is just one of 15 examples).

Now we need to map the affected addresses. I'm thinking of a loop that will go through the highways. It should return any objects tagged with and addr:street that is identical to one of the "name" values of the previous query. But only if they are within, say, 250 meter of the object with this name. From what I've seen, this should be possible, but I don't really know how to start.

Once the streetname changes take effect, the query can be adapted to compare highway old_name to addr:street, a query which should then over time result in an empty dataset.

asked 24 Oct '18, 19:05

joost%20schouppe's gravatar image

joost schouppe
3.4k245087
accept rate: 12%


2 Answers:

3

Try http://overpass-turbo.eu/s/D5q

[out:xml][timeout:120];
( area["name"="Vlaanderen"]["admin_level"="4"]; )->.b;
( area["name"="Deinze"][admin_level=8](area.b); )->.a;
way["highway"][name=Warandestraat](area.a)(area.b)->.streets;
foreach.streets->.street(
  nwr(around.street:250)["addr:street"](if: t["addr:street"]==street.set(t["name"]));
  (._;>;);
  out;
);

The foreach statement goes through the input set one element at a time storing the element in .street so it is available inside of the if: block.

I stuck the street name in there to speed up testing, you'd obviously want to remove that.

(The blog posts about recent releases, like https://dev.overpass-api.de/blog/final_0_7_54.html continue to be the best source of examples for stuff like the if: block there)

answered 24 Oct '18, 20:04

maxerickson's gravatar image

maxerickson
12.7k1083176
accept rate: 32%

Thanks! Those release notes are a bit above me unfortunately. I try to learn something every time though. Anyway, if I try this for an entire level 8 admin area, it seems to be too much for the server. But we can always do it one by one if needed.

(24 Oct '18, 20:15) joost schouppe

0

http://overpass-turbo.eu/s/D5H

[out:xml][timeout:120];
area["name"="Vlaanderen"]["admin_level"="4"];
//if you want to restrit to one municipality, uncomment the next line
//area["name"="Deinze"][admin_level=8](area);
way["fixme:name"](area);
way._["highway"]->.streets;
foreach.streets->.street(
  nwr(around.street:250)["addr:street"](if: t["addr:street"]==street.set(t["name"]));
  out geom;
);

minors improvements based on maxerickson query to avoid "out of memory" issue for the whole set :

  • reduce the (area.a)(area.b) to only one area test (the 2nd area is already a part of the first one)
  • line 5 : avoid to store the area with a name due we only use it once at the next line
  • line 5+6 : get first list with "fixme:name" (less objets) before checking if a highway tag exist
  • line 9 : change "(._;>;); out;" into "out geom;"

answered 24 Oct '18, 21:58

marc_marc's gravatar image

marc_marc
112
accept rate: 0%

Source code available on GitHub .