Biểu trưng OpenStreetMap OpenStreetMap

Mass edits are bad

Do Cascafico đăng vào 18 tháng 05 năm 2020 bằng 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

Biểu tượng thư điện tử Biểu tượng Bluesky Biểu tượng Facebook Biểu tượng LinkedIn Biểu tượng Mastodon Biểu tượng Telegram Biểu tượng X

Thảo luận

Bình luận của yvecai vào 20 tháng 05 năm 2020 lúc 05:16

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

Đăng nhập để nhận xét