logo separator

[mkgmap-dev] Multipolygons and basic question on polygons with holes

From Steve Ratcliffe steve at parabola.me.uk on Fri Jan 1 23:19:01 GMT 2010

On 01/01/10 13:43, Mark Burton wrote:
> Yes, my alternative scheme for sea/land does require a TYP file so it
> can't be the method used in the Garmin maps.

OK

> What would be very useful is if the IMG format supported a polygon
> type that cut a hole in the polygon below it. Are we sure that such a
> beast does not exist? How about trying to find an unlocked Garmin map
> that contains sea with islands and examine it carefully?

I've looked at one of my maps and it works just in the way that the
multipolygon code works in that there is a single polygon with a cut
between the hole and the outer polygon.

Some observations

1. The sea polygon is probably cut up into small enough pieces first,
before the "cuts" to the hole are made.
2. Because we do things the other way round, we make the cut a slight
wedge shape, as you cannot send polygons that have touching segments
to the polygon splitting code.  This is what makes things look bad.
3. If you split a sea polygon with a line that goes "through" (around)
a hole then you don't need to add a cut.
4. Its probably easier to do it by hand, but that might just reflect
my lack of knowledge of GIS algorithms in this area...

I realise that it would be easier if I made a drawing so look at
http://www.mkgmap.org.uk/tmp/islands.png

In nicely working maps A and B are coincident, as are C and D. In our
maps C and D are not, our original code also made them coincident, but
this failed when the polygon was big enough to need splitting.  This
is why I suggest attempting to split large polygons first.

Point 3 is illustrated by the second diagram, where a sea polygon is
split into X and Y and avoids the need for a DABC cut as in the first.
It may not be easy to take advantage of this with an algorithm, but
I'd probably make use of that a lot if doing it by hand.

Cheers,

..Steve



More information about the mkgmap-dev mailing list