logo separator

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

From WanMil wmgcnfg at web.de on Sat Oct 27 12:49:05 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.

The two tags needn't be a memory problem just by changing a few other 
things (I will post a patch within the next days). Anyhow we could 
decide to set mkgmap:closed=true and mkgmap:autoclosing=true only.
I think mkgmap:closed might make sense to have a chance in the lines 
style to skip an element. I don't have a good example but there are some 
tags that can be used for lines and polygons.

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

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

Sounds good. I supposed that splitter removes the node refs for all 
nodes not contained in the tile. If that's not the case your idea is 
much better than the patch.

> The information that the way is incomplete might be worth saving too.
> Then 'is_closed()' might be a good candidate for a style
> function?

Yes - and is_inpomplete() :-) At the moment I do not make good progress 
in the style-functions branch. Steve, do you think it's ok to merge the 
current implementation which requires that a function cannot be used on 
its own? Otherwise the optimizer removes the function-only-rule.

> ..Steve


P.S.: I am happy if you merge the style-include branch! Good work!

More information about the mkgmap-dev mailing list