logo separator

[mkgmap-dev] Enhancement on SubstitutionFilter.java to handle regexp (filter "subst:")

From Enrico Liboni eliboni at gmail.com on Wed Aug 7 23:17:10 BST 2013

I  updated  the SubstitutionFilter.java class in order to allow regexp on
the subst filters by using the operator "~>"  to state the first  argument
is a regexp. The default behavior is maintained if no operator  (i.e.
remove string) or "=>" is used

This is convenient for mass corrections or in case we'll have some tweaks
to apply on street address names to facilitate search, for example the
style entry below (Carlos!)

highway=* & name ~ '[Aa]venida [Dd]e [Ee]l .*' { add
streettype:movend='${name|subst:Avenida De El |subst:Avenida De el
|subst:Avenida de El |subst:Avenida de el |subst:avenida De El
|subst:avenida De el |subst:avenida de El |subst:avenida de el }'}

will become

highway=* & name ~ '[Aa]venida [Dd]e [Ee]l .*' { add
streettype:movedend='${name|subst:[Aa]venida [Dd]e [Ee]l ~>}'}


Technically, the change is minimal, it is just checking the filter operator
(=> or ~>) and using replaceAll() instead of replace() if "~>" is used.

Attached the updated class - I really hope it will be included and be
useful!

Cheers,
Enrico
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.mkgmap.org.uk/pipermail/mkgmap-dev/attachments/20130808/9c42dca1/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SubstitutionFilter.java
Type: application/octet-stream
Size: 1615 bytes
Desc: not available
Url : http://lists.mkgmap.org.uk/pipermail/mkgmap-dev/attachments/20130808/9c42dca1/attachment.obj 


More information about the mkgmap-dev mailing list