logo separator

[mkgmap-dev] New style branch

From Steve Ratcliffe steve at parabola.me.uk on Mon Aug 7 21:43:55 BST 2017

Hi

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

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:

    http://www.mkgmap.org.uk/download/mkgmap-expr-latest.zip

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.

..Steve


More information about the mkgmap-dev mailing list