[postgis-users] Union, but need to exclude any void

Paul Ramsey pramsey at cleverelephant.ca
Sun Nov 2 10:41:48 PST 2008


A time-honored approach to tricking flood-fill routines into honoring
holes is the "zero width corridor"  between the outer and inner rings,
using clockwise orientation on the outer ring and counter-clockwise on
the inner. So, instead of this:

POLYGON((0 0, 0 10, 10 10, 10 0, 0 0), (2 2, 2 3, 3 3, 3 2, 2 2))

You do this:

POLYGON((0 0, 0 10, 10 10, 10 0, 0 0, 2 2, 3 2, 3 3, 2 3, 2 2, 0 0))

The main things to be careful of are: to ensure your corridor does not
cross the inner ring on the way to the start point; and, to be careful
of your ring orientation.

P.

On Sat, Nov 1, 2008 at 3:52 PM, Toby Rainthorpe
<toby.rainthorpe at frsltd.co.uk> wrote:
> I can confirm that the union does work correctly. My problem comes from
> using the google maps api to represent the data. As far as I can tell google
> maps polygons cannot have void / inner boundary. I think the only way to
> create the void is to find the minimum number of polygons that can make up
> the polygon with the void, but not include it.
>
> For instance looking a 5 x 5 grid with two voids I could use a minimum of
> two polygons to create the illusion of the void.
> 1 = Polygon 1
> 2 = Polygon 2
> x = Void
>
> 1       1       1       2       2
> 1       1       1       X       2
> 1       X       2       2       2
> 1       1       1       1       1
> 1       1       1       1       1
>
> You can use a KML file, however there are size restrictions. You can also
> use collect and render all the polygons to get the desired effect, however
> this is inefficient and becomes harder to style correctly.
>
> Does anyone know if a open layers, mapserver, geo server etc. setup would be
> able to deal with voids / inner boundaries of polygons directly. Or any
> other ideas of getting around this issue with the google maps api?
>
> Thanks for your help,
>
> Toby
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>



More information about the postgis-users mailing list