logo separator

[mkgmap-dev] Style rules and 'generated' tags

From Steve Ratcliffe steve at parabola.demon.co.uk on Thu Jul 2 12:50:26 BST 2009

Hi Richard

> The rules I’m using (in ‘lines’) are this:
>
> 	ncn_ref=* { set ncn=yes; echo 'Converting from ${ncn_ref}'; }
> 	  ( highway=bridleway | highway=byway | highway=cycleway |
> 	  highway=track | highway=footway) & ( ncn=yes | rcn=yes )
> 	  { set offroad='yes'; echo 'Offroad route'; }
> 	ncn=yes { echo 'Is NCN'; }
> 	offroad=yes { echo 'Is offroad'; }
> 	ncn=yes & offroad=yes { echo 'NCN Offroad'; set highway=ncn_offroad; }
> 	ncn=yes & offroad!=* { echo 'NCN Onroad'; set highway=ncn_onroad; }

There is nothing wrong with this and I would like it to work.

However what currently happens is that for each node/way/relation I go
through the tags exactly once and find the earliest rule that matches.
Rules with actions have the actions run when seen.  So in this case I
believe that ncn is already set and has been processed so the change is too
late.

This is clearly unsatisfactory, but these tips might help:

1. Where possible always have the same tag on the left.  This will make
things more predictable.  For example if you had 'offroad=yes & ncn=yes'
the results would appear more consistant.  Of course this is not always
possible, including in this very case :(

2. Always set made-up tag names if you want to also match on them later.
For example use mkgmap:ncn or something.  Since the tag is not in the input
it cannot possibly have been used yet and so will get its chance later
on.  It would have to be the left most term too.

A final fix would either be about enforcing and clarifying restriction
or would probably be slower.  But as long as the normal case is a
similar speed I don't mind.

> (As you can see I added an echo statement to aid debugging... that’s  
> about the limit of my Java. :) )

Hey, that looks useful, could you send a patch?

Cheers,

..Steve



More information about the mkgmap-dev mailing list