NOTICE: 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
accept rate: 12%


( area["name"="Vlaanderen"]["admin_level"="4"]; )->.b;
( area["name"="Deinze"][admin_level=8](area.b); )->.a;
  nwr(around.street:250)["addr:street"](if: t["addr:street"]==street.set(t["name"]));

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 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

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

//if you want to restrit to one municipality, uncomment the next line
  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

accept rate: 0%

Follow this question

By Email:

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



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "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:


question asked: 24 Oct '18, 19:05

question was seen: 3,007 times

last updated: 24 Oct '18, 21:58

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