logo separator

[mkgmap-dev] Style functions

From WanMil wmgcnfg at web.de on Fri Aug 31 17:16:11 BST 2012

Hi,

I have created the branch style-functions to implement functions like 
mkgmap::length that can be used in the style system.

The mkgmap::length function is the first one that has been implemented. 
It returns the length of a way in metre. For relations it returns the 
sum of way length of all members.
The function can be used like a tag name:

highway=* & access=private & mkgmap::length < 10 { delete highway }

Calculations are cached. So the mkgmap::length is calculated not more 
than once per element.

Known bugs:
- Rules with a function must always contain a tag rule. Otherwise the 
optimizer disposes the rule. so the rule
   mkgmap::length < 10 { delete highway }
will never be executed.

- The length of relations does not always makes sense. E.g. the length 
of turn restrictions, multipolygons maybe should be not calculated.


Steve: can you have a look on it and give your comment if the 
implementation looks good to you and what you dislike and what you want 
to change :-) Can you please also give a hint how I can tell the 
optimizer that functions should always be treated as an existing tag.
Do you think it makes more sense to implement the functions as an 
additional operator?
I am free to change the implementation completely :-)

WanMil



More information about the mkgmap-dev mailing list