logo separator

[mkgmap-dev] Way.isClosed()

From Gerd Petermann gpetermann_muenchen at hotmail.com on Thu Dec 19 08:19:14 GMT 2013


I read again this discussion 

I still don't have a good idea what is_closed() should return in case of special cases.

Assume these different ways in the input file:
input file contains nodes :
n1 to n9 , nx is missing in the file but exists in OSM planet, 
n1 is equal to n9, means, the coordinates rounded to map units are equal

way 1 : n1,n2,n3...,n8,n9
way 2 : n1,n2,n3...,n8,n1
way 3: nx,n1,n2,n3,nx
way 4: n1,n2,n9
way 5: n1,n2,n1
way 6: nx,n2,nx

What result do you expect from the is_closed() style function?
I really don't know what to say for the special cases.

My understanding is this:
a) the style author should not be bothered with the question about 
incomplete data. If the way is not complete, mkgmap might try to 
close it, but when style processing starts the way is either closed or not,
and closed means first and last point are identical. 
If the incomplete ways (3 and 6) cannot be closed by mkgmap,
they should be dropped beforre style processing.
b) A way should not be passed to the polygon rules if it is not closed or 
has less than four points (three points form a line)
c) the style function is_closed() should return true for all
ways passed to the polygon style rules
d) is_closed() should not return true for a way that cannot be 
passed to the polygon rules.

In other words, I'd prefer to have a rule is_polygon() which returns
true if the way has more than 3 points AND first and last point are identical.
This can be used in the lines rules to decide that a polygon rule might match better.



From: gpetermann_muenchen at hotmail.com
To: mkgmap-dev at lists.mkgmap.org.uk
Date: Tue, 17 Dec 2013 17:29:36 +0100
Subject: Re: [mkgmap-dev] Way.isClosed()

> > Do you agree?
> >
> Yes. I wonder if hasEqualEndPoints() is required?

not If all routines that create shapes make sure that
they add the identical point to close the shape. In trunk,
this is not always the case, so I use it find those cases.
I'll post a patch later to show my results.

> But you need to take care about any way copy made within mkgmap. I think 
> the closed flag is copied very seldom (which is wrong).
hmm, yes, and the docu for is_closed says
"+true+ the way is closed. +false+ the way is not closed and cannot be processed as polygon."
that would imply that we should use something like
way.getPoints.size() > 2 && way.hasIdenticalEndPoints()
to evalute is_closed() 


mkgmap-dev mailing list
mkgmap-dev at lists.mkgmap.org.uk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mkgmap.org.uk/pipermail/mkgmap-dev/attachments/20131219/e7be3a18/attachment-0001.html>

More information about the mkgmap-dev mailing list