OSM Tools
dutch german en francais spanish spanish polish russian

More Tricks

Tricks & Tips: Abbreviations

It is fairly straight forward to abbreviate Street names, ie turn Road into Rd. or Street into St.

However, on short names, such abbreviations seem somewhat unnecessary.

With some effort you can enable abbreviation only if

Street Abbreviations

Road: Howeth Road

Rd : Columbia Rd

Close: Kings Close

Cl. : Archdale Cl

Gardens: Lewis Gardens

Gdns: Hendford Gdns

Split names in to parts

set word1='${name|part:" :1"}';


set word2='${name|part:" :2"}';


add word3='${name|part:" :3"}';

We don't need more words; if there are 3 words we presume it needs abbreviating anyway

Length of string using 'substring'

highway=* { set len='${word1|substring:"8"}'}

len is 'empty' if the length of name < 8

Main condition

if (highway=* & len =*|word3=*) then

# abbreviate if there is a 3rd word or if the length of wrd1>7

else

end

Abbreviate

word2 = * {set name='$(word2)'}
word3 = * {set name='$(word3)'}

name=* {set name = '${name|subst:Road=>RD}' ; # etc

# rebuild street name

word3=* {set name='$(word1) $(word2) $(name)';delete word2;}#
word2=* {set name='$(word1) $(name)'; } #