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

Paragon Corporation lr at pcorp.us
Sun Nov 2 13:23:49 PST 2008


Paul,

Curious - is there an easy way to do this in PostGIS without resorting to
string parsing?

I assume you would start with ST_ForceRHR, dump the points, make line, add
the closing point, make polygon,  but that sounds like a lot of steps.


Toby,
Open Layers I would guess would have a better time or at least you would
have more options.

For Open Layers for small polygon cases where I need a somewhat dynamic
query or to highlight as user clicks, I use a WFS call.  

Usually I just use UMN Mapserver as a WMS/WFS server and overlay as an
OpenLayer WMS/WFS layer.  
Then I use Google or some other WMS as a base layer in OpenLayers. Works
pretty nicely.  I can't recall if I have had polygons with holes that I have
called with a WFS call.

Hope that helps,
Regina 

-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Paul
Ramsey
Sent: Sunday, November 02, 2008 1:42 PM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] Union, but need to exclude any void

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