logo separator

[mkgmap-dev] Commit: r1708: This can be used to extract substrings from values.

From svn commit svn at mkgmap.org.uk on Tue Sep 28 09:56:18 BST 2010

Version 1708 was commited by steve on 2010-09-28 09:56:18 +0100 (Tue, 28 Sep 2010) 

This can be used to extract substrings from values.
If the "name" tag on an object was equal to "abcdef":

'${name|substring:2}' => 'cdef'
'${name|substring:2:4}' => 'cd'

As an example, it can be used to clean up the "ref" element on route relations:

type=route & route=road & network=US:I & ref ~ 'I\d+' { apply { set route_network='US:I'; set route_ref='${ref|substring:1}'; } }
type=route & route=road & network=US:I & ref ~ 'I \d+' { apply { set route_network='US:I'; set route_ref='${ref|substring:2}'; } }
type=route & route=road & network=US:I & ref ~ 'I-\d+' { apply { set route_network='US:I'; set route_ref='${ref|substring:2}'; } }
type=route & route=road & network=US:I & ref ~ '\d+' { apply { set route_network='US:I'; set route_ref='${ref}'; } }

-Jeffrey Ollie


More information about the mkgmap-dev mailing list