# [geos-devel] Polygonizer returns inner rings on their own?

Martin Davis mbdavis at refractions.net
Wed Aug 5 12:01:07 EDT 2009

```The Polygonizer creates every possible polygon defined by the input
linework.  That is, it forms the linework into a polygonal coverage.
That's why the hole also has a polygon filling it.

This is one common requirement for polygonization.  Howwever, I can see
that it might be useful to be able to specify that the Polygonizer
should return only a (Multi)Polygon out of the input linework, which
sounds like it would meet your need.  This would compute the depth
parity of the (potentially nested) polygons, and discard those with even
parity.  I might try and add this to JTS shortly.

Frederik Ramm wrote:
> Hi,
>
>    why is it that the (C++) Polygonizer, when given the following four
> geometries,
>
>         "LINESTRING(1 1, 1 10, 10 10)"
>         "LINESTRING(10 10, 10 1, 1 1)"
>         "LINESTRING(20 20, 20 30, 30 30, 30 20, 20 20)"
>         "LINESTRING(3 3, 3 4, 4 4, 4 3, 3 3)"
>
> (1 and 2 together form a shell, 3 forms a disjunct shell, 4 forms an
> inner ring of 1+2)
>
> returns a collection of three polygons:
>
> POLYGON ((1.00 1.00, 1.00 10.00, 10.00 10.00, 10.00 1.00, 1.00 1.00),
> (3.00 3.00, 4.00 3.00, 4.00 4.00, 3.00 4.00, 3.00 3.00))
> POLYGON ((20.00 20.00, 20.00 30.00, 30.00 30.00, 30.00 20.00, 20.00
> 20.00))
> POLYGON ((3.00 3.00, 3.00 4.00, 4.00 4.00, 4.00 3.00, 3.00 3.00))
>
> I'm ok with the first and second, but the third one has already been
> used as a "hole" inside the first and should not be returned again -
> or is there a misunderstanding on my part?
>
> Bye
> Frederik
>

--
Martin Davis
Senior Technical Architect
Refractions Research, Inc.
(250) 383-3022

```

More information about the geos-devel mailing list