logo separator

[mkgmap-dev] [PATCH] not-equal filter to remove redundant labels

From Clinton Gladstone clinton.gladstone at googlemail.com on Wed Nov 11 00:39:00 GMT 2009

I find the attached patch quite useful. It adds a style filter which checks if one tag value is identical to another, and if so, it filters out the value. This can elegantly reduce redundant information in labels, for example when name and ref are identical.

The filter is called "not-equal" and takes a tag name as an argument. Example: "${int_name|not-equal:name}" will only return the international name if it is not the same as the "normal" name.

I have the following line in my points file:

  place=* {name '${name} (${name:en|not-equal:name})' | '${name} (${int_name|not-equal:name})' | '${name}' }

This will print either the English name or the International name in brackets, but only if they are not equal to the name. Thus I get "Köln (Cologne)" in my maps, but not "Karlsruhe (Karlsruhe)" (instead, just "Karlsruhe" is printed).

Although I have not tested this yet, the filter could be applied to names and refs in roads. For example if both the name and ref are set to "B12", the  filter would prevent the road from being labelled as "B12 B12".

All feedback is appreciated.

Cheers.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: cg-notequal-filter-v1.patch
Type: application/octet-stream
Size: 3643 bytes
Desc: not available
Url : http://lists.mkgmap.org.uk/pipermail/mkgmap-dev/attachments/20091111/4404f3d1/attachment.obj 


More information about the mkgmap-dev mailing list