Abbreviations
How to replace Road with Rd , Street with St
Not only does it save space in an img , it also makes your map less cluttered.
For this we use the subst: filter - see mkgmap's manual
Illustration shows roads (Rd) , drives (Dr) , Close (Cls)
The following applies to countries which place 'street' at the end of a name.
example1:
name~'.*Road' & highway=* { set name='${name|subst:"Road=>RD"}'}
Place this in lines before the highways are parsed
It appears 'name~'.*Road' ' has to be inserted else if a name does not contain 'road' it gets deleted using the name|subst filter.
All Roads now appear as Rd ( not RD - this is a Garmin issue.
The only way to make them appear as RD is to place a space between R and D ie
name~'.*Road' & highway=* { set name='${name|subst:"Road=>R D"}'}
example2:
name~'.*Crescent' & highway=* { set name='${name|subst:"Crescent=>Cres"}'}
name~'.*Crescent' & highway=* { set name='${name|subst:"Crescent=>Cres"}'}
How to replace Rue with R. and Boulevard with BVD
Where 'road' is placed at the beginning of a name the code is slightly different:
name~'Boulevard.*' & highway=* { set name='${name|subst:"Boulevard=>BVD"}'}
name~'Rue.*' & highway=* { set name='${name|subst:"Rue=>R."}'}
How to replace the French 'des' / 'de' with d.
The following line of code does NOT work
name~'.*Des.*' & highway=* { set name='${name|subst:"Des=>D."}'} #Does Not WORK!
Instead we've opted to use the 'part' function to split a street name in to 3 parts.
'Part' splits the street name using 'space' as a separator. ${name|part:" :2"}
highway=* & name=* {add 2ndwrd='${name|part:" :2"}'} # check for existence of more than one word in sentence separated by space
highway=* & 2ndwrd==* {set name='${name|part:"
:1"} d. ${name|part:" :3"}'}
There is one problem - the above only caters for street names with 3 words ;
The above code would replace ' Rue de la gare ' with 'Rue d. la' .
However with some ingenuity it can be modified to cater for 4 words if the third word='la'.
To be honest , general mkgmap's string manipulation extremely cumbersome.
If a name contains several words, how do I show only the first 2?
I am indebted to Barry Bickerton who says:
'I have "National Byway (County Durham and Northumberland)" plastered all over my map so I have used the filter :
(ncn=yes | rcn=yes) { name '${rcnname|part:" <3"}'} [0x10018 resolution 22 continue with_actions]
to extract only the first two words from the name, there seem to be quite a few routes which have the start and finish incorporated in their names.'
How to show abbreviations & still search for unabridged names
Showing abbreviations ( High St) is fine but you still want to be able to search for 'High Street '
Before you abbreviate the street names use mkgmap:label:
highway=residential & mkgmap:label:2!=* {set mkgmap:label:2='${name} (${ref})' | '${ref}' | '${name}'}
The manual states that label:3&4 are used for searching but it seems label:2 does the same
How to replace Park with prk ,Wood with wd
name~'.*Park { set name='${name|subst:"Park=>Prk"}'}
name~'.*Wood { set name='${name|subst:"Wood=>Wd"}'}
This time the above code is placed in the Polygons file.
However , it should be improved as Car Park will also be rendered as Car Pk
leisure=* & name~'.*Park { set name='${name|subst:"Park=>Prk"}'}
natural=wood & name~'.*Wood { set name='${name|subst:"Wood=>Wd"}'}