NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

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%


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)

permanent link

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

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;"
permanent link

answered 24 Oct '18, 21:58

marc_marc's gravatar image

marc_marc
112
accept rate: 0%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×483
×228

question asked: 24 Oct '18, 19:05

question was seen: 3,330 times

last updated: 24 Oct '18, 21:58

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum