logo separator

[mkgmap-dev] [PATCH v1] Decide in style file if a way is closed automatically

From Steve Ratcliffe steve at parabola.me.uk on Fri Oct 26 21:35:53 BST 2012

Hi

>   		Rule rules;
> +		way.addTag("mkgmap:closed",String.valueOf(way.isClosed()));
> +		way.addTag("mkgmap:autoclosing", "false");

I don't much like the idea of adding two tags to every single way.

> +				// the way may be closed automatically because both endpoints are outside the bbox
> +				// set a tag so that these ways can be ignored in the style rules
> +				way.addTag("mkgmap:autoclosing", "true");

It seems to me that setting this is all that is required. It will only
affect relatively few ways, and you can test for tag existence rather
than having to know/remember if you should test against 'true',
'True', 'yes', '1' or whatever.

But apart from that, the main thing is that any rule that uses this will
still be guessing -- what if it really was a polygon? Then you
will have a missing area of water.

I think we can do better though. We can know if the way really is
closed even when all its nodes are not included, since the first
and last <nd ref="..."> values will be the same for the first
and last points in the way.

Currently we ignore any node ref in the way for which there is no
actual node coordinates during parsing, but we could keep track of the
node id's and compare the first and last ones when the way is
created.  Then a flag could be set on the way, to say that it is
definitely closed and you would no longer have to guess.

The information that the way is incomplete might be worth saving too.

Then 'is_closed()' might be a good candidate for a style
function?

..Steve



More information about the mkgmap-dev mailing list