logo separator

[mkgmap-dev] New style branch

From Gerd Petermann GPetermann_muenchen at hotmail.com on Wed Aug 9 09:02:25 BST 2017

Hi Steve,

I've tried it with a slightly modified version of Minkos OFM lite style and got a NPE.
My command:
java -jar c:\temp\mkgmap-expr-r3990\mkgmap.jar  --style-file=c:\mystyles\ofm_lite --check-styles
Style see http://files.mkgmap.org.uk/download/355/ofm_lite.zip
I've also noted an experimental line in the default style lines file:
!!(aeroway=runway & highway!=*) & foo=bar [0x1]

        at uk.me.parabola.mkgmap.osmstyle.eval.NotExistsOp.toString(NotExistsOp.java:39)
        at uk.me.parabola.mkgmap.osmstyle.eval.AbstractBinaryOp.toString(AbstractBinaryOp.java:54)
        at uk.me.parabola.mkgmap.osmstyle.eval.AbstractBinaryOp.toString(AbstractBinaryOp.java:65)
        at java.util.Formatter$FormatSpecifier.printString(Unknown Source)
        at java.util.Formatter$FormatSpecifier.print(Unknown Source)
        at java.util.Formatter.format(Unknown Source)
        at java.util.Formatter.format(Unknown Source)
        at java.lang.String.format(Unknown Source)
        at uk.me.parabola.mkgmap.osmstyle.ExpressionArranger.fmtExpr(ExpressionArranger.java:560)
        at uk.me.parabola.mkgmap.osmstyle.ExpressionArranger.arrange(ExpressionArranger.java:73)
        at uk.me.parabola.mkgmap.osmstyle.RuleFileReader.loadFile(RuleFileReader.java:125)
        at uk.me.parabola.mkgmap.osmstyle.RuleFileReader.load(RuleFileReader.java:95)
        at uk.me.parabola.mkgmap.osmstyle.StyleImpl.readRules(StyleImpl.java:301)
        at uk.me.parabola.mkgmap.osmstyle.StyleImpl.<init>(StyleImpl.java:155)
        at uk.me.parabola.mkgmap.osmstyle.StyleImpl.readStyle(StyleImpl.java:545)
        at uk.me.parabola.mkgmap.reader.osm.OsmMapDataSource.createConverter(OsmMapDataSource.java:333)
        at uk.me.parabola.mkgmap.reader.osm.OsmMapDataSource.setupHandler(OsmMapDataSource.java:226)
        at uk.me.parabola.mkgmap.reader.osm.OsmMapDataSource.parse(OsmMapDataSource.java:168)
        at uk.me.parabola.mkgmap.reader.osm.OsmMapDataSource.load(OsmMapDataSource.java:150)
        at uk.me.parabola.mkgmap.main.MapMaker.loadFromFile(MapMaker.java:154)
        at uk.me.parabola.mkgmap.main.MapMaker.makeMap(MapMaker.java:52)
        at uk.me.parabola.mkgmap.main.Main$1.call(Main.java:263)
        at uk.me.parabola.mkgmap.main.Main$1.call(Main.java:259)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Von: mkgmap-dev <mkgmap-dev-bounces at lists.mkgmap.org.uk> im Auftrag von Steve Ratcliffe <steve at parabola.me.uk>
Gesendet: Montag, 7. August 2017 22:43:55
An: mkgmap development
Betreff: [mkgmap-dev] New style branch


Every now and again, there is a bug report on a style rule that gives
an error when it shouldn't.  The most recent from Mike Baggaley,
included a case where the rule was accepted but the result was

I wrote a little program to generate random rules and test them using
the style tester.

This showed that there were many rules that should be accepted that
are not and worse there are cases where the wrong result is given.

Worst of all this simple rule:

    a>=1 & (a=1 | b~2) [0x2]

(and many others) crash mkgmap with a StackOverflowError.  I'm
surprised that no-one has found that.  Perhaps they have and it just
hasn't been reported.

An example of a rule that is accepted but doesn't work is:

    (a!=1 | b~2) & a<2 & a>=2 [0x2]

This matches (with trunk) with a way with tags a=2 and b=2
but it should not.

So not very complex rules fail.  There are also vast number of rules
that involve using not (!) such as !(highway=service & ...) that are
not accepted or do not work.  Probably not many styles have many such
rules though.

So I re-wrote and simplified the code and the result is
on the expr branch.

There is also a new feature that was needed to help make it
work.  There is now a not regex match operator !~.  It is
probably not all that useful but it is now availabl.

    name !~ 'Main.*'

is exactly the same as

    !(name ~ 'Main.*')

The latest branch build can be downloaded from:


It is important to test it, as although I believe that the branch is
now correct, some styles may have been relying on previous bugs.

mkgmap-dev mailing list
mkgmap-dev at lists.mkgmap.org.uk

More information about the mkgmap-dev mailing list