logo separator

[mkgmap-dev] Style file tester

From Steve Ratcliffe steve at parabola.me.uk on Sun Jan 24 12:39:38 GMT 2010

Hi

I have written a utility that can be used for demonstrating style bugs
and requests.  See the attached patch.

It allows you to create a file containing ways with tags and a set of
style rules.  You can then run this file and see what elements would
be produced.  If this is wrong or you disagree with the results you
can post the whole result along with what you wanted to happen.

It also attempts to calculate what would happen if the rules were
run in order from the top to the bottom on the way.  If the result is
different, then this is printed out as a failure after the actual
results.

Anything that depends on the order that actions are executed in is
likely to fail on trunk, so any such example will just be collected
and used to ensure that the style branch is working OK.

Anyway, here is an example of it in use.  Create a file called
example1 with the following contents.

	WAY 1
	highway=primary
	type=good
	aa=5
	name=Main Street

	<<<lines>>>
	highway=* & type=good & aa=5    {set aa=6; }

	highway=primary & aa=6 [0x26 ]
	highway=* & aa=6 [0x27 ]

Then run as (with the correct location of mkgmap.jar if different):

	java -cp dist/mkgmap.jar uk.me.parabola.mkgmap.main.StyleTester example1

This will print out the input file followed by a results section:

<<<results>>>
WAY 1:
     Line 0x27, name=<Main Street>, ref=<null>, res=24-24 (1/1),(2/2),
   FAIL. If rules were run strictly in order this would be:
     Line 0x26, name=<Main Street>, ref=<null>, res=24-24 (1/1),(2/2),

This shows that the trunk code will select the last rule, but
it should have selected the previous one.

More notes

* If more than one element is produced, as a result of using continue
   say, then they are all printed.
* Ways are created with two points (1,1) and (2,2) so you can see
   reversals
* You can have any number of WAY definitions, each of which must be
   ended with a blank line
* You can put a number after the WAY so that you can tell them apart
   in the results.

..Steve
-------------- next part --------------
A non-text attachment was scrubbed...
Name: style_printer.patch
Type: text/x-patch
Size: 17041 bytes
Desc: not available
Url : http://lists.mkgmap.org.uk/pipermail/mkgmap-dev/attachments/20100124/bc4125b5/attachment.bin 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: example1
Url: http://lists.mkgmap.org.uk/pipermail/mkgmap-dev/attachments/20100124/bc4125b5/attachment.pl 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: example2
Url: http://lists.mkgmap.org.uk/pipermail/mkgmap-dev/attachments/20100124/bc4125b5/attachment-0001.pl 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: example3
Url: http://lists.mkgmap.org.uk/pipermail/mkgmap-dev/attachments/20100124/bc4125b5/attachment-0002.pl 


More information about the mkgmap-dev mailing list