logo separator

[mkgmap-dev] Some observations

From Gerd Petermann gpetermann_muenchen at hotmail.com on Mon May 30 13:33:19 BST 2022

Hi Andrzej,

to be honest, I don't understand enough of the rule parsing to
improve the syntax. I don't even know for sure why
mkgmap:option:test!=true { add foo=bar}
is not supported. Might be coding complexity, might be run time performance.
On the other hand you already found the work around
to use
if (mkgmap:option:test=true) then else { add foo=bar} end

I don't think that if-then can improve performance. The rules are not compiled in a
way that would allow to skip something. On the other hand a lot of caching happens so
that in rules like
junction=roundabout & (highway=trunk | highway=trunk_link) [0x0c road_class=4 road_speed=2 resolution 24 continue]
junction=roundabout & (highway=trunk | highway=trunk_link) [0x10801 resolution 18]
the common expression is stored only once and the result of the first evaluation is simply reused in the 2nd rule.

With the next rule
junction=roundabout & (highway=primary | highway=primary_link) & mkgmap:fast_road=yes [0x0c road_class=4 road_speed=2 resolution 24 continue]
the expression junction=roundabout is again reused and only the other expressions are computed.
Only problem: When an action changes any tag of the object all cached results are cleared.

Gerd




________________________________________
Von: mkgmap-dev <mkgmap-dev-bounces at lists.mkgmap.org.uk> im Auftrag von Andrzej Popowski <popej at poczta.onet.pl>
Gesendet: Montag, 30. Mai 2022 13:51
An: mkgmap-dev at lists.mkgmap.org.uk
Betreff: Re: [mkgmap-dev] Some observations

Hi Gerd,

thanks for explanations.

 > the option --make-opposite-cycleways is implemented like this

Somehow I imagined, that opposite cycleway is magically added at a final
step, when the main road is already prepared by style. Your way is more
flexible, but needs more diligence in style. Actually I had to make a
lot corrections in my style, when I realized how it works. It would be
good to add your explanation to options.txt.

 > The manual has this note:

"There used to be some restrictions on the kind of expression you could
use. Now the only restriction is you must have at least one test that
depends on a tag existing. So you cannot match on everything, regardless
of tags, or test for an object that does not have a tag."

Sorry, I missed it. It is at the section, "Combining tag tests", while I
was interested in a single test. I read the section "Allowed operations"
and found no difference between using tag=value and tag!=value. This
make me wonder, why "mkgmap:option:test=true" works but
"mkgmap:option:test!=true" doesn't.

To be true, I'm not understanding this explanation. What does it mean
"tag existing"? Does tag "highway" exist but "mkgmap:synthesised" doesn't?

 > I wonder why mkgmap complains. Seems it checks only the "if" part.

I guess it is about "if then", most problems appear when I try to use
this statement. Another question: is the condition of "if then"
statement checked once or for each line included in the conditional
block? I wonder whether "if then" could optimize processing of style.

--
Best regards,
Andrzej
_______________________________________________
mkgmap-dev mailing list
mkgmap-dev at lists.mkgmap.org.uk
https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


More information about the mkgmap-dev mailing list