OpenStreetMap logo OpenStreetMap

Correcting addr:housenumber in the name field

Posted by watmildon on 19 November 2022 in English. Last updated on 20 November 2022.

The Issue

A common tagging mistake that I’ve encountered a few times is putting the addr:housenumber into the name field. Data of this type tends to be old so it seems the modern tools do a better job keeping this kind of edit from happening. However, when you do find this issue there’s usually a lot of objects to clean up which can be a bother without the right tools.

Finding objects

Here’s the overpass query I’ve used a few times that provides a reasonably stating place:

/*
This has been generated by the overpass-turbo wizard.
The original search was:
“"name"~"^[0-9]" and "building"”
*/
[out:json][timeout:25];
// gather results
(
  // query part for: “name~/^[0-9]/ and building”
  way["name"~"^[0-9]"]["building"]({{bbox}});
  relation["name"~"^[0-9]"]["building"]({{bbox}});
);
// print results
out body;
>;
out skel qt;

Update! User marczoutendijk from the Discord server has provided this overpass query that does a great job finding more instances if this with low noise:

(
  node["name"~"^[0-9]+$"]["addr:housenumber"~"^[0-9]+$"]["brand"!~"."]["shop"!~"."]["amenity"!~"."]["highway"!~"."];
);

The Cleanup

The easiest workflow I’ve found it to load the area into JOSM and run a search with some more specificity. Here’s the search for any building way that has a name tag with numbers at the beginning and doesn’t have an addr:housenumber tag:

name~"^[0-9]+" and building=* and type:way and -"addr:housenumber"

Or for names that are up to 3 numbers and nothing more (ex: 7,25,123):

name~"^[0-9]{1,3}" and building=* and type:way and -"addr:housenumber"

Or a name that represents a range of housenumbers (ex: 12-16):

name~"^[0-9]+.[0-9]+" and building=* and type:way and -"addr:housenumber"

Once you have the right set of objects selected, the tag editior will let you rename the “name” tag to “addr:housenumber”. I like to do a spotcheck or values in the name tag to make sure there’s nothing surprising and then the changes can be uploaded.

Discussion

Comment from mariotomo on 27 November 2022 at 17:06

hi. maybe this topic could give ideas on alternatives. (I’ve seen that the new platform helps greatly overcome the language barrier :smile:)

Comment from watmildon on 28 November 2022 at 07:23

Thank you for sharing! Seems all too easy to miss the correct accent marks. Reminds me of this excellent diary about finding and fixing spelling in the “cuisine” tag which you may find interesting.

Log in to leave a comment