logo separator

[mkgmap-dev] Bug Report: First rule matches in style files ... not quite!

From Steve Ratcliffe steve at parabola.demon.co.uk on Wed Apr 22 23:06:30 BST 2009

Hi

On Mon, Apr 20, 2009 at 02:17:53PM +0200, Thilo Hannemann wrote:
> It says in the documentation that the first rule in the style file that 
> matches the elements is the one used. That is not quite true!
>
> The reason is, that the code handles the rules by putting them into  
> baskets organized by the first condition of the rule (with some  
> exceptions). There is for example a basket for all rules with the first 
> condition "highway=residential". When deciding which rule to apply the 
> code will iterate through all the tags of the osm element. It will 
> determine whether there is a corresponding basket and then apply all the 
> rules in that basket in sequence, until one fits.

That is how it works, except that it is not just the first tag to match,
but the best match.  So for each tag, you get the first match within the
basket as you say, but then all the other tags are matched against
their own baskets and the one with the lowest priority is used.  That is
the rule earliest in the file.

That is what is meant to happen anyway.

I remember thinking that there could be a case where something unexpected
happens but I can't think of it at this moment.

> To summarize the problem: The baskets are not ordered, therefore the  
> application of the rules is only "until first hit" inside a basket.  
> Between baskets it is "first tag in the osm data that fits".

The rules within the baskets are in the order they are read
and all baskets that match any tag are considered and not just the first.
There could be problems, but I don't think that they are as pronounced as
you are saying.

Regards,

..Steve



More information about the mkgmap-dev mailing list