[postgis-users] Intersection errors

Josh@oklieb josh at oklieb.net
Tue Jun 7 18:40:37 PDT 2005


Inner and outer rings are usually distinguished by the direction in  
which the coordinates are strung together.

from the shapefile spec:

A polygon consists of one or more rings.  A ring is a connected  
sequence of four or more
points that form a closed, non-self-intersecting loop.  A polygon may  
contain multiple
outer rings.  The order of vertices or orientation for a ring  
indicates which side of the ring
is the interior of the polygon.  The neighborhood to the right of an  
observer walking along
the ring in vertex order is the neighborhood inside the polygon.   
Vertices of rings defining
holes in polygons are in a counterclockwise direction.  Vertices for  
a single, ringed
polygon are, therefore, always in clockwise order.  The rings of a  
polygon are referred to
as its parts.


--josh

On Jun 7, 2005, at 6:33 PM, Ethan Alpert wrote:

>
> The problem is if it's a multipolygon you can have 3 consecutive outer
> rings with no inner rings which will look the same as your example.
>
> I opened up the shp2pgsql.c code and sure enough it computes the  
> area of
> the polygon for each polygon. If the area is negative it's an inner  
> ring
> if it's positive it's a new outer ring.
>
> -e
>
> -----Original Message-----
> From: postgis-users-bounces at postgis.refractions.net
> [mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of  
> Sean
> M. Montague
> Sent: Tuesday, June 07, 2005 4:25 PM
> To: PostGIS Users Discussion
> Subject: RE: [postgis-users] Intersection errors
>
>
> I may be wrong, but I believe it's the order.  If a poly has two inner
> rings, There will be a list of 3 polys, the first of which is the  
> outer
> poly, the two inner come next.  At least this been my experience
> exporting shape files.
>
> -----Original Message-----
> From: postgis-users-bounces at postgis.refractions.net
> [mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of
> Ethan Alpert
> Sent: Tuesday, June 07, 2005 2:05 PM
> To: PostGIS Users Discussion
> Subject: RE: [postgis-users] Intersection errors
>
>
>
> While we're on the topic of multipolygons. I've noticed that the
> shapefile specification doesn't have any convention for communicating
> outer and inner rings. That said how do apps like shp2pgsql and  
> ogr2ogr
> determine whether the next polygon in a list is an inner or a new  
> outer?
> I understand that the convention is that inner rings are counter
> clockwise. But still how is the direction of the ring determined
> efficiently?
>
>
>
> -e
>
> -----Original Message-----
> From: postgis-users-bounces at postgis.refractions.net
> [mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of
> Markus Schaber
> Sent: Tuesday, June 07, 2005 2:02 PM
> To: PostGIS Users Discussion
> Subject: Re: [postgis-users] Intersection errors
>
>
> Hi, Sean,
>
> Sean M. Montague schrieb:
>
>> I've been working on it, and I now realize the problem...not sure if
>> it will solve my intersect problem, but I'll get to that later.   
>> There
>>
>
>
>> is a logical reason for dissolving some of layers, such as lakes at
>> certain scales.  If they are multi polys, there is a significant size
>> savings when writing out as SVG.  I just need to see if I can
>> distinguish between a hole, and say another lake.  Examining what you
>> suggested looks like a good start.  Thanks.
>>
>
> Yes, it is easily possible. Maybe you should take a look at the Well
> Known Text format specification from the OpenGIS consortium (Part of
> their "Simple features for SQL" specification, or use the PostGIS  
> source
> or some other program that correctly exports WKT to find out how it
> works.
>
> The basic idea for Multipolygon is:
>
> MULTIPOLYGON(((First polygon outer ring),(1st poly first hole),(1st  
> poly
> 2nd hole)),((2nd Poly outer ring)(2nd Poly hole)),((3rd Poly with no
> hole)),((4th Poly outer ring)(4th poly 1st hole)(4th poly 2nd hole)))
>
> All holes (inner rings) have to be completely inside their outer ring,
> and may not overlap each other. A polygon may be contained completely
> inside the hole of another polygon (like an island), but they may not
> overlap.
>
> For the exact rules how the inner and outer rings may touch and
> intersect, please see geometry model part of the aforementioned
> specification.
>
> HTH,
> Markus
>
> _______________________________________________
> 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
> _______________________________________________
> 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
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20050607/23d187c6/attachment.html>


More information about the postgis-users mailing list