logo separator

[mkgmap-dev] Bug Report: First rule matches in style files - SOLVED, was false alarm

From Thilo Hannemann thannema at gmx.de on Thu Apr 23 00:06:46 BST 2009

Am 23.04.2009 um 00:06 schrieb Steve Ratcliffe:
>
> 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.

You are completely right. I should learn to *really* read the code.

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

How ActionRules are applied in order is still a mystery to me, but  
that was not what my mail was about.

>> 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.

Sorry for that. And many thanks for your clarification!

Best regards,
Thilo




More information about the mkgmap-dev mailing list