logo separator

[mkgmap-dev] Some observations

From Ticker Berkin rwb-mkgmap at jagit.co.uk on Mon May 30 18:45:03 BST 2022

Hi

Firstly:

I don't get a crash from:

if (mkgmap:style-option:test=true) then
	() echo {"test"}
end

with or without --style-option=test.
Also, don't you mean "... mkgmap:option:test ..." 

Next:

The "test" part of a rule must contain at least 1 "positive" limiting
clause, as per the style-manual paragraph already mentioned. The best
limiting clause is used first when determining if an object meets the
condition.

Secondly:

My understanding is that if/then/else requires the same positive
limiting in the "if" condition and then just incorporates the "if"
condition into all of the "then" conditions and !(ifcond) into all of
the "else" conditions, so that:

if (ifCond) then
  (thenCond1) {thenAct1}
  (thenCond2) {thenAct2}
else
  (elseCond) {elseAct}
end

is, apart from the extra constraint on "ifCond" mentioned above, just
the same as if you had written:

(ifCond) & (thenCond1) {thenAct1}
(ifCond) & (thenCond2) {thenAct2}
!(ifCond) & (elseCond1) {elseAct1}

The full "else" test also require positive limiting and this can only
come from the "elseCond". Attempting:

if (someTag=*) then
else
  () {actionIfNotSet}
end

won't fool the rule processor and you'll get the "Invalid rule, unable
to index" error.

Finally:

If you really want some action based on missing tags, then you can use
the --style-option=x to set a tag on all elements and then use this
along with the required negative test eg:

if (mkgmap:option:x=true & mkgmap:synthesized!=yes) then
  (junction=roundabout ...) {...}
  (...) {...}
end

but this will probably be less efficient than writing:

mkgmap:synthesized!=yes & junction=roundabout & ...  {...}
mkgmap:synthesized!=yes & ... {...}

because, when written with "if", every object matches the first
processed clause, but when written without, the first thing evaluated
is junction=roundabout

Ticker



More information about the mkgmap-dev mailing list