logo separator

[mkgmap-dev] Some observations

From Gerd Petermann gpetermann_muenchen at hotmail.com on Mon May 30 04:47:35 BST 2022

Hi Andrzej,

a)
the option --make-opposite-cycleways is implemented like this;
1) before(!) style processing mkgmap looks at the OSM way and detects a possible need for a cycleway. If so, it creates a copy of the OSM way with tags for bicylce access only and mkgmap:synthesised=yes
2) still before style processing it sets bicycle=no for the original OSM way
3) it passes the original way through the style processing
4) it passes the copy through the style processing

b)
Your rule
if (mkgmap:synthesised!=yes) then
junction=roundabout & (highway=tertiary | highway=tertiary_link)
[0x10804 resolution 21]
end

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

Your rule could indeed be changed to
junction=roundabout & (highway=tertiary | highway=tertiary_link) & mkgmap:synthesised!=yes [0x10804 resolution 21]
so I wonder why mkgmap complains. Seems it checks only the "if" part.
That would also explain the crash with the invalid statement.

Gerd




________________________________________
Von: mkgmap-dev <mkgmap-dev-bounces at lists.mkgmap.org.uk> im Auftrag von Andrzej Popowski <popej at poczta.onet.pl>
Gesendet: Sonntag, 29. Mai 2022 22:10
An: mkgmap-dev at lists.mkgmap.org.uk
Betreff: [mkgmap-dev] Some observations

Hi,

I have tweaked my maps recently and tripped on some problems. Nothing
serious, but a bit troublesome.

First I noticed, that tweak for better looking roundabouts not always
works. In default style there is something like that:

junction=roundabout & (highway=tertiary | highway=tertiary_link) [0x0c
road_class=1 road_speed=1 resolution 24 continue]
junction=roundabout & (highway=tertiary | highway=tertiary_link)
[0x10804 resolution 21]

I have noticed, that sometimes I get roundabout partially covered by
line 0x10804. Maybe mkgmap is splitting roundabout and a part of it is
written into img after line 0x10804? Sorry, I have reworked my style and
can't provide an example now.

Then I got problems with --make-opposite-cycleways. Looks like this
option is not executed at finalize step, but the created line gets full
processing in style. If there exist somewhere a roundabout with opposite
cycle line, then default style will create double lines 0x10804. Safe
version of style would be:

mkgmap:synthesised!=yes & junction=roundabout & (highway=tertiary |
highway=tertiary_link) [0x10804 resolution 21]

Then I have found that following doesn't work:

if (mkgmap:synthesised!=yes) then
junction=roundabout & (highway=tertiary | highway=tertiary_link)
[0x10804 resolution 21]
end

Result:
Mkgmap version 4902
Time started: Sun May 29 21:47:50 CEST 2022
SEVERE (global): Error in style: Error: (lines:15): Invalid rule,
expression cannot be indexed: $mkgmap:synthesised!=yes
SEVERE (global): Could not open style

But this one works:

if (mkgmap:synthesised=yes) then else
junction=roundabout & (highway=tertiary | highway=tertiary_link)
[0x10804 resolution 21]
end

I understand, that there is some kind of optimization for keywords, but
why one type of condition works while others don't? Mkgmap accepts
"keyword=false" but not "keyword=!true" nor "!(keyword=true)". If this
is unavoidable, then would be nice to get a warning in manual.

Finally I made an error in style and crashed mkgmap. I wrote something
like this:

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

and got following:

Mkgmap version 4902
Time started: Sun May 29 21:06:03 CEST 2022
SEVERE (global): Unexpected error
java.lang.NullPointerException: Cannot invoke
"uk.me.parabola.mkgmap.osmstyle.eval.Op.isType(uk.me.parabola.mkgmap.osmstyle.eval.NodeType)"
because the return value of
"uk.me.parabola.mkgmap.osmstyle.eval.Op.getFirst()" is null
        at
uk.me.parabola.mkgmap.osmstyle.ExpressionArranger.selectivity(ExpressionArranger.java:381)
        at
uk.me.parabola.mkgmap.osmstyle.ExpressionArranger.arrangeAndChain(ExpressionArranger.java:348)
        at
uk.me.parabola.mkgmap.osmstyle.ExpressionArranger.arrangeTop(ExpressionArranger.java:95)
        at
uk.me.parabola.mkgmap.osmstyle.ExpressionArranger.arrange(ExpressionArranger.java:74)
        at
uk.me.parabola.mkgmap.osmstyle.RuleFileReader.loadFile(RuleFileReader.java:132)
        at
uk.me.parabola.mkgmap.osmstyle.RuleFileReader.load(RuleFileReader.java:102)
        at uk.me.parabola.mkgmap.osmstyle.StyleImpl.readRules(StyleImpl.java:303)
        at uk.me.parabola.mkgmap.osmstyle.StyleImpl.<init>(StyleImpl.java:158)
        at uk.me.parabola.mkgmap.osmstyle.StyleImpl.readStyle(StyleImpl.java:546)
        at
uk.me.parabola.mkgmap.reader.osm.OsmMapDataSource.createConverter(OsmMapDataSource.java:324)
        at
uk.me.parabola.mkgmap.reader.osm.OsmMapDataSource.setupHandler(OsmMapDataSource.java:206)
        at
uk.me.parabola.mkgmap.reader.osm.OsmMapDataSource.parse(OsmMapDataSource.java:166)
        at
uk.me.parabola.mkgmap.reader.osm.OsmMapDataSource.load(OsmMapDataSource.java:142)
        at uk.me.parabola.mkgmap.main.MapMaker.loadFromFile(MapMaker.java:165)
        at uk.me.parabola.mkgmap.main.MapMaker.makeMap(MapMaker.java:58)
        at uk.me.parabola.mkgmap.main.Main.lambda$processFilename$1(Main.java:291)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
        at
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:833)
SEVERE (global): Exiting due to unexpected error
Number of ExitExceptions: 1


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