OpenStreetMap

Mass edits are bad

Posted by Cascafico on 18 May 2020 in Italian (Italiano)

problem

A fast undocumented address import caused some concert in Bergamo municipality. One of them was mixed formats housenumbers:

  • upper-lowercase extensions (ie: 3D, 42f)
  • space between (ie: 3 D, 42 F)
  • slash between (ie: 3/D)

fixing

queries:

  • slash between number and extension
  • lowercase address extensions
  • space between number and extension

export:

overpass-turbo allows to export in Level0 text editor (500 elements limit): just cut and paste in your favorite editor, mine are Notepadd++ (Windows) and sed (Linux).

slash removal:

notepad++ regex slash removal
find:
housenumber = ([0-9]+)/([^0-9])
replace:
housenumber = \1\2

Linux sed:
sed -r -e ‘s:housenumber = ([0-9]*)/([a-zA-Z])$:housenumber = \1\2:’ level0.txt

uppercase :

notepad++ find and replace uppercase housenumber:

find: housenumber = ([0-9]+)(\w)$ replace: housenumber = \1\U$2

Comment from yvecai on 20 May 2020 at 05:16

Luckily enough, sed can fix a mass edit! :-)

Login to leave a comment