Intersection errors

classic Classic list List threaded Threaded
22 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Intersection errors

Sean M. Montague
Several months ago I had posted on this list about some intersection
problems I was having, but was never able to solve it.  I gave up with
the intentions of revisiting it if version 1 did not fix the bug.  It
has not.  The problem arises when trying to intersect one poly with
another when it has holes.  If the intersecting poly partially overlays
a hole, it throws an error.  Below is the geometry with holes and the
two intersection statements.  The first works, it does not intersect any
part of the hole.  The second fails.  I've tried to keep it simple.
Thanks.

Sean


GeometryFromText('MULTIPOLYGON(((-244339 1210399, -244339 1541250, 21058
1541250, 21058 1210399, -244339 1210399)),((-39283 1521307, -57692
1518238, -64340 1511591, -62805 1497784, -54112 1494716, -45931 1494716,
-40306 1494204, -38260 1493693, -34681 1482443, -42862 1471705, -50021
1460966, -51044 1448182, -41840 1437955, -27522 1431307, -8601 1422614,
603 1409318, 92 1392955, -13715 1377103, -46953 1370455, -68942 1365341,
-91442 1342841, -91442 1309092, -81726 1303467, -2976 1329546, 13899
1358182, 14921 1431818, -7067 1513125, -39283 1521307)))',32767)

SELECT intersection(the_geom, PolygonFromText('POLYGON((-341457 1496785,
-161897 1496785, -161897 1317225, -341457 1317225, -341457
1496785))',32767))
As the_geom
>From test_02
WHERE layer='3'
AND the_geom && PolygonFromText('POLYGON((-341457 1496785, -161897
1496785, -161897 1317225, -341457 1317225, -341457 1496785))',32767);

Returns:
"0103000020FF7F000001000000050000000000000098D30DC1000000006919344100000
00098D30DC100000000D1D636410000000048C303C100000000D1D636410000000048C30
3C100000000691934410000000098D30DC10000000069193441"



SELECT intersection(the_geom, PolygonFromText('POLYGON((-213394 1467529,
-33834 1467529, -33834 1287969, -213394 1287969, -213394
1467529))',32767))
As the_geom
>From test_02
WHERE layer='3'
AND the_geom && PolygonFromText('POLYGON((-213394 1467529, -33834
1467529, -33834 1287969, -213394 1287969, -213394 1467529))',32767);

Returns:
NOTICE:  AssertionFailedException: EdgeRing::computePoints: found null
Directed Edge

ERROR:  GEOS Intersection() threw an error!
_______________________________________________
postgis-users mailing list
[hidden email]
http://postgis.refractions.net/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|

Re: Intersection errors

Darren Houston
Hi Sean,

I'm correct in assuming the multipolygon posted is the geometry at
layer=3? I received a false isvalid on that multipolygon.

'POSTGIS="1.0.1" GEOS="3.0.0" PROJ="Rel. 4.4.9, 29 Oct 2004" USE_STATS
DBPROC="0.3.0" RELPROC="0.3.0"'

I'm in a rush, but I promise to look at it more tomorrow.

Darren H.

Sean M. Montague wrote:

>Several months ago I had posted on this list about some intersection
>problems I was having, but was never able to solve it.  I gave up with
>the intentions of revisiting it if version 1 did not fix the bug.  It
>has not.  The problem arises when trying to intersect one poly with
>another when it has holes.  If the intersecting poly partially overlays
>a hole, it throws an error.  Below is the geometry with holes and the
>two intersection statements.  The first works, it does not intersect any
>part of the hole.  The second fails.  I've tried to keep it simple.
>Thanks.
>
>Sean
>
>
>GeometryFromText('MULTIPOLYGON(((-244339 1210399, -244339 1541250, 21058
>1541250, 21058 1210399, -244339 1210399)),((-39283 1521307, -57692
>1518238, -64340 1511591, -62805 1497784, -54112 1494716, -45931 1494716,
>-40306 1494204, -38260 1493693, -34681 1482443, -42862 1471705, -50021
>1460966, -51044 1448182, -41840 1437955, -27522 1431307, -8601 1422614,
>603 1409318, 92 1392955, -13715 1377103, -46953 1370455, -68942 1365341,
>-91442 1342841, -91442 1309092, -81726 1303467, -2976 1329546, 13899
>1358182, 14921 1431818, -7067 1513125, -39283 1521307)))',32767)
>
>SELECT intersection(the_geom, PolygonFromText('POLYGON((-341457 1496785,
>-161897 1496785, -161897 1317225, -341457 1317225, -341457
>1496785))',32767))
>As the_geom
>>From test_02
>WHERE layer='3'
>AND the_geom && PolygonFromText('POLYGON((-341457 1496785, -161897
>1496785, -161897 1317225, -341457 1317225, -341457 1496785))',32767);
>
>Returns:
>"0103000020FF7F000001000000050000000000000098D30DC1000000006919344100000
>00098D30DC100000000D1D636410000000048C303C100000000D1D636410000000048C30
>3C100000000691934410000000098D30DC10000000069193441"
>
>
>
>SELECT intersection(the_geom, PolygonFromText('POLYGON((-213394 1467529,
>-33834 1467529, -33834 1287969, -213394 1287969, -213394
>1467529))',32767))
>As the_geom
>>From test_02
>WHERE layer='3'
>AND the_geom && PolygonFromText('POLYGON((-213394 1467529, -33834
>1467529, -33834 1287969, -213394 1287969, -213394 1467529))',32767);
>
>Returns:
>NOTICE:  AssertionFailedException: EdgeRing::computePoints: found null
>Directed Edge
>
>ERROR:  GEOS Intersection() threw an error!
>_______________________________________________
>postgis-users mailing list
>[hidden email]
>http://postgis.refractions.net/mailman/listinfo/postgis-users
>  
>

_______________________________________________
postgis-users mailing list
[hidden email]
http://postgis.refractions.net/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|

Re: Intersection errors

strk
I've tested this with both latest GEOS and JTS, both fail.
Also, I confirm that the MULTIPOLYGON is found to be non-valid.
--strk;

On Mon, Jun 06, 2005 at 08:29:50PM -0600, Darren Houston wrote:

> Hi Sean,
>
> I'm correct in assuming the multipolygon posted is the geometry at
> layer=3? I received a false isvalid on that multipolygon.
>
> 'POSTGIS="1.0.1" GEOS="3.0.0" PROJ="Rel. 4.4.9, 29 Oct 2004" USE_STATS
> DBPROC="0.3.0" RELPROC="0.3.0"'
>
> I'm in a rush, but I promise to look at it more tomorrow.
>
> Darren H.
>
> Sean M. Montague wrote:
>
> >Several months ago I had posted on this list about some intersection
> >problems I was having, but was never able to solve it.  I gave up with
> >the intentions of revisiting it if version 1 did not fix the bug.  It
> >has not.  The problem arises when trying to intersect one poly with
> >another when it has holes.  If the intersecting poly partially overlays
> >a hole, it throws an error.  Below is the geometry with holes and the
> >two intersection statements.  The first works, it does not intersect any
> >part of the hole.  The second fails.  I've tried to keep it simple.
> >Thanks.
> >
> >Sean
> >
> >
> >GeometryFromText('MULTIPOLYGON(((-244339 1210399, -244339 1541250, 21058
> >1541250, 21058 1210399, -244339 1210399)),((-39283 1521307, -57692
> >1518238, -64340 1511591, -62805 1497784, -54112 1494716, -45931 1494716,
> >-40306 1494204, -38260 1493693, -34681 1482443, -42862 1471705, -50021
> >1460966, -51044 1448182, -41840 1437955, -27522 1431307, -8601 1422614,
> >603 1409318, 92 1392955, -13715 1377103, -46953 1370455, -68942 1365341,
> >-91442 1342841, -91442 1309092, -81726 1303467, -2976 1329546, 13899
> >1358182, 14921 1431818, -7067 1513125, -39283 1521307)))',32767)
> >
> >SELECT intersection(the_geom, PolygonFromText('POLYGON((-341457 1496785,
> >-161897 1496785, -161897 1317225, -341457 1317225, -341457
> >1496785))',32767))
> >As the_geom
> >>From test_02
> >WHERE layer='3'
> >AND the_geom && PolygonFromText('POLYGON((-341457 1496785, -161897
> >1496785, -161897 1317225, -341457 1317225, -341457 1496785))',32767);
> >
> >Returns:
> >"0103000020FF7F000001000000050000000000000098D30DC1000000006919344100000
> >00098D30DC100000000D1D636410000000048C303C100000000D1D636410000000048C30
> >3C100000000691934410000000098D30DC10000000069193441"
> >
> >
> >
> >SELECT intersection(the_geom, PolygonFromText('POLYGON((-213394 1467529,
> >-33834 1467529, -33834 1287969, -213394 1287969, -213394
> >1467529))',32767))
> >As the_geom
> >>From test_02
> >WHERE layer='3'
> >AND the_geom && PolygonFromText('POLYGON((-213394 1467529, -33834
> >1467529, -33834 1287969, -213394 1287969, -213394 1467529))',32767);
> >
> >Returns:
> >NOTICE:  AssertionFailedException: EdgeRing::computePoints: found null
> >Directed Edge
> >
> >ERROR:  GEOS Intersection() threw an error!
> >_______________________________________________
> >postgis-users mailing list
> >[hidden email]
> >http://postgis.refractions.net/mailman/listinfo/postgis-users
> >
> >
>
> _______________________________________________
> postgis-users mailing list
> [hidden email]
> http://postgis.refractions.net/mailman/listinfo/postgis-users
_______________________________________________
postgis-users mailing list
[hidden email]
http://postgis.refractions.net/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|

RE: Intersection errors

Sean M. Montague
In reply to this post by Sean M. Montague
Correct, below is the insert statement I construct from AV 3 using
Avenue.  I'm not sure about the isvalid.  Is that what you get when
trying to insert it?  Thanks.

Sean

INSERT INTO "test_02" ("objectid","name","layer","the_geom") VALUES
('3','3','3',GeometryFromText('MULTIPOLYGON(((-244339 1210399, -244339
1541250, 21058 1541250, 21058 1210399, -244339 1210399)),((-39283
1521307, -57692 1518238, -64340 1511591, -62805 1497784, -54112 1494716,
-45931 1494716, -40306 1494204, -38260 1493693, -34681 1482443, -42862
1471705, -50021 1460966, -51044 1448182, -41840 1437955, -27522 1431307,
-8601 1422614, 603 1409318, 92 1392955, -13715 1377103, -46953 1370455,
-68942 1365341, -91442 1342841, -91442 1309092, -81726 1303467, -2976
1329546, 13899 1358182, 14921 1431818, -7067 1513125, -39283
1521307)))',32767))


-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of
Darren Houston
Sent: Monday, June 06, 2005 8:30 PM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] Intersection errors

Hi Sean,

I'm correct in assuming the multipolygon posted is the geometry at
layer=3? I received a false isvalid on that multipolygon.

'POSTGIS="1.0.1" GEOS="3.0.0" PROJ="Rel. 4.4.9, 29 Oct 2004" USE_STATS
DBPROC="0.3.0" RELPROC="0.3.0"'

I'm in a rush, but I promise to look at it more tomorrow.

Darren H.
_______________________________________________
postgis-users mailing list
[hidden email]
http://postgis.refractions.net/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|

Re: Intersection errors

Paul Ramsey
It's not valid, because legal multipolygons do not have parts that
interact. Your multipolygon has two parts and one is completely
contained in the other. No cookie for you!

Paul

Sean M. Montague wrote:

> Correct, below is the insert statement I construct from AV 3 using
> Avenue.  I'm not sure about the isvalid.  Is that what you get when
> trying to insert it?  Thanks.
>
> Sean
>
> INSERT INTO "test_02" ("objectid","name","layer","the_geom") VALUES
> ('3','3','3',GeometryFromText('MULTIPOLYGON(((-244339 1210399, -244339
> 1541250, 21058 1541250, 21058 1210399, -244339 1210399)),((-39283
> 1521307, -57692 1518238, -64340 1511591, -62805 1497784, -54112 1494716,
> -45931 1494716, -40306 1494204, -38260 1493693, -34681 1482443, -42862
> 1471705, -50021 1460966, -51044 1448182, -41840 1437955, -27522 1431307,
> -8601 1422614, 603 1409318, 92 1392955, -13715 1377103, -46953 1370455,
> -68942 1365341, -91442 1342841, -91442 1309092, -81726 1303467, -2976
> 1329546, 13899 1358182, 14921 1431818, -7067 1513125, -39283
> 1521307)))',32767))
>
>
> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of
> Darren Houston
> Sent: Monday, June 06, 2005 8:30 PM
> To: PostGIS Users Discussion
> Subject: Re: [postgis-users] Intersection errors
>
> Hi Sean,
>
> I'm correct in assuming the multipolygon posted is the geometry at
> layer=3? I received a false isvalid on that multipolygon.
>
> 'POSTGIS="1.0.1" GEOS="3.0.0" PROJ="Rel. 4.4.9, 29 Oct 2004" USE_STATS
> DBPROC="0.3.0" RELPROC="0.3.0"'
>
> I'm in a rush, but I promise to look at it more tomorrow.
>
> Darren H.
> _______________________________________________
> postgis-users mailing list
> [hidden email]
> http://postgis.refractions.net/mailman/listinfo/postgis-users

_______________________________________________
postgis-users mailing list
[hidden email]
http://postgis.refractions.net/mailman/listinfo/postgis-users

untitled.gif (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

RE: Intersection errors

Sean M. Montague
In reply to this post by Sean M. Montague
It's a hole.  It should be valid...I think.  What about islands in a
lake?  The only time I have a problem with them is when I intersect one.

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Paul
Ramsey
Sent: Tuesday, June 07, 2005 11:35 AM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] Intersection errors

It's not valid, because legal multipolygons do not have parts that
interact. Your multipolygon has two parts and one is completely
contained in the other. No cookie for you!

Paul

Sean M. Montague wrote:

> Correct, below is the insert statement I construct from AV 3 using
> Avenue.  I'm not sure about the isvalid.  Is that what you get when
> trying to insert it?  Thanks.
>
> Sean
>
> INSERT INTO "test_02" ("objectid","name","layer","the_geom") VALUES
> ('3','3','3',GeometryFromText('MULTIPOLYGON(((-244339 1210399, -244339
> 1541250, 21058 1541250, 21058 1210399, -244339 1210399)),((-39283
> 1521307, -57692 1518238, -64340 1511591, -62805 1497784, -54112
1494716,
> -45931 1494716, -40306 1494204, -38260 1493693, -34681 1482443, -42862
> 1471705, -50021 1460966, -51044 1448182, -41840 1437955, -27522
1431307,
> -8601 1422614, 603 1409318, 92 1392955, -13715 1377103, -46953
1370455,

> -68942 1365341, -91442 1342841, -91442 1309092, -81726 1303467, -2976
> 1329546, 13899 1358182, 14921 1431818, -7067 1513125, -39283
> 1521307)))',32767))
>
>
> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of
> Darren Houston
> Sent: Monday, June 06, 2005 8:30 PM
> To: PostGIS Users Discussion
> Subject: Re: [postgis-users] Intersection errors
>
> Hi Sean,
>
> I'm correct in assuming the multipolygon posted is the geometry at
> layer=3? I received a false isvalid on that multipolygon.
>
> 'POSTGIS="1.0.1" GEOS="3.0.0" PROJ="Rel. 4.4.9, 29 Oct 2004" USE_STATS

> DBPROC="0.3.0" RELPROC="0.3.0"'
>
> I'm in a rush, but I promise to look at it more tomorrow.
>
> Darren H.
> _______________________________________________
> postgis-users mailing list
> [hidden email]
> http://postgis.refractions.net/mailman/listinfo/postgis-users

_______________________________________________
postgis-users mailing list
[hidden email]
http://postgis.refractions.net/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|

RE: Intersection errors

Sean M. Montague
In reply to this post by Sean M. Montague
I just tested it, it does not work.  Very interesting.  This explains a
lot.  Is there not a way to cut holes in polygons?

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Sean
M. Montague
Sent: Tuesday, June 07, 2005 11:41 AM
To: PostGIS Users Discussion
Subject: RE: [postgis-users] Intersection errors

It's a hole.  It should be valid...I think.  What about islands in a
lake?  The only time I have a problem with them is when I intersect one.

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Paul
Ramsey
Sent: Tuesday, June 07, 2005 11:35 AM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] Intersection errors

It's not valid, because legal multipolygons do not have parts that
interact. Your multipolygon has two parts and one is completely
contained in the other. No cookie for you!

Paul
_______________________________________________
postgis-users mailing list
[hidden email]
http://postgis.refractions.net/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|

RE: Intersection errors

Sean M. Montague
In reply to this post by Sean M. Montague
I take it back.  It does work.  When I export to SVG, I set
fill-rule="evenodd", and the hole appears.

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Sean
M. Montague
Sent: Tuesday, June 07, 2005 11:46 AM
To: PostGIS Users Discussion
Subject: RE: [postgis-users] Intersection errors

I just tested it, it does not work.  Very interesting.  This explains a
lot.  Is there not a way to cut holes in polygons?

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Sean
M. Montague
Sent: Tuesday, June 07, 2005 11:41 AM
To: PostGIS Users Discussion
Subject: RE: [postgis-users] Intersection errors

It's a hole.  It should be valid...I think.  What about islands in a
lake?  The only time I have a problem with them is when I intersect one.

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Paul
Ramsey
Sent: Tuesday, June 07, 2005 11:35 AM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] Intersection errors

It's not valid, because legal multipolygons do not have parts that
interact. Your multipolygon has two parts and one is completely
contained in the other. No cookie for you!

Paul
_______________________________________________
postgis-users mailing list
[hidden email]
http://postgis.refractions.net/mailman/listinfo/postgis-users
_______________________________________________
postgis-users mailing list
[hidden email]
http://postgis.refractions.net/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|

Re: Intersection errors

Paul Ramsey
In reply to this post by Sean M. Montague
Sean,

Change your script, it's not writing things out right... you are writing
MULTIPOLYGON parts instead of POLYGON parts. If you wrote polygon parts,
the hole would be a hole instead of another polygon...

MULTIPOLYGON(((-244339 1210399, -244339
1541250, 21058 1541250, 21058 1210399, -244339 1210399),(-39283
1521307, -57692 1518238, -64340 1511591, -62805 1497784, -54112
1494716, -45931 1494716, -40306 1494204, -38260 1493693, -34681 1482443,
-42862 1471705, -50021 1460966, -51044 1448182, -41840 1437955, -27522
1431307, -8601 1422614, 603 1409318, 92 1392955, -13715 1377103, -46953
1370455, -68942 1365341, -91442 1342841, -91442 1309092, -81726 1303467,
-2976 1329546, 13899 1358182, 14921 1431818, -7067 1513125, -39283
1521307)))

Note: "),(" instead of ")),((". Double note: Arcview *does* support
multipolygons, so you have to write those out correctly too (otherwise
you'll create more invalid geometries, by treating multiparts as holes).

Paul

Sean M. Montague wrote:

> It's a hole.  It should be valid...I think.  What about islands in a
> lake?  The only time I have a problem with them is when I intersect one.
>
> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of Paul
> Ramsey
> Sent: Tuesday, June 07, 2005 11:35 AM
> To: PostGIS Users Discussion
> Subject: Re: [postgis-users] Intersection errors
>
> It's not valid, because legal multipolygons do not have parts that
> interact. Your multipolygon has two parts and one is completely
> contained in the other. No cookie for you!
>
> Paul
>
> Sean M. Montague wrote:
>
>>Correct, below is the insert statement I construct from AV 3 using
>>Avenue.  I'm not sure about the isvalid.  Is that what you get when
>>trying to insert it?  Thanks.
>>
>>Sean
>>
>>INSERT INTO "test_02" ("objectid","name","layer","the_geom") VALUES
>>('3','3','3',GeometryFromText('MULTIPOLYGON(((-244339 1210399, -244339
>>1541250, 21058 1541250, 21058 1210399, -244339 1210399)),((-39283
>>1521307, -57692 1518238, -64340 1511591, -62805 1497784, -54112
>
> 1494716,
>
>>-45931 1494716, -40306 1494204, -38260 1493693, -34681 1482443, -42862
>>1471705, -50021 1460966, -51044 1448182, -41840 1437955, -27522
>
> 1431307,
>
>>-8601 1422614, 603 1409318, 92 1392955, -13715 1377103, -46953
>
> 1370455,
>
>>-68942 1365341, -91442 1342841, -91442 1309092, -81726 1303467, -2976
>>1329546, 13899 1358182, 14921 1431818, -7067 1513125, -39283
>>1521307)))',32767))
>>
>>
>>-----Original Message-----
>>From: [hidden email]
>>[mailto:[hidden email]] On Behalf Of
>>Darren Houston
>>Sent: Monday, June 06, 2005 8:30 PM
>>To: PostGIS Users Discussion
>>Subject: Re: [postgis-users] Intersection errors
>>
>>Hi Sean,
>>
>>I'm correct in assuming the multipolygon posted is the geometry at
>>layer=3? I received a false isvalid on that multipolygon.
>>
>>'POSTGIS="1.0.1" GEOS="3.0.0" PROJ="Rel. 4.4.9, 29 Oct 2004" USE_STATS
>
>
>>DBPROC="0.3.0" RELPROC="0.3.0"'
>>
>>I'm in a rush, but I promise to look at it more tomorrow.
>>
>>Darren H.
>>_______________________________________________
>>postgis-users mailing list
>>[hidden email]
>>http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
> _______________________________________________
> postgis-users mailing list
> [hidden email]
> http://postgis.refractions.net/mailman/listinfo/postgis-users

_______________________________________________
postgis-users mailing list
[hidden email]
http://postgis.refractions.net/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|

Re: Intersection errors

Paul Ramsey
In reply to this post by Sean M. Montague
Just because you can scanline fill a geometry does not make it valid :)
Check my previous email. You have all the information in AV3, you just
need to write it out correctly and everything will be pluperfect.

P

Sean M. Montague wrote:

> I take it back.  It does work.  When I export to SVG, I set
> fill-rule="evenodd", and the hole appears.
>
> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of Sean
> M. Montague
> Sent: Tuesday, June 07, 2005 11:46 AM
> To: PostGIS Users Discussion
> Subject: RE: [postgis-users] Intersection errors
>
> I just tested it, it does not work.  Very interesting.  This explains a
> lot.  Is there not a way to cut holes in polygons?
>
> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of Sean
> M. Montague
> Sent: Tuesday, June 07, 2005 11:41 AM
> To: PostGIS Users Discussion
> Subject: RE: [postgis-users] Intersection errors
>
> It's a hole.  It should be valid...I think.  What about islands in a
> lake?  The only time I have a problem with them is when I intersect one.
>
> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of Paul
> Ramsey
> Sent: Tuesday, June 07, 2005 11:35 AM
> To: PostGIS Users Discussion
> Subject: Re: [postgis-users] Intersection errors
>
> It's not valid, because legal multipolygons do not have parts that
> interact. Your multipolygon has two parts and one is completely
> contained in the other. No cookie for you!
>
> Paul
> _______________________________________________
> postgis-users mailing list
> [hidden email]
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> _______________________________________________
> postgis-users mailing list
> [hidden email]
> http://postgis.refractions.net/mailman/listinfo/postgis-users

_______________________________________________
postgis-users mailing list
[hidden email]
http://postgis.refractions.net/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|

Re: Intersection errors

Paul Ramsey
In reply to this post by Paul Ramsey
Just to complete the discussion on multipolygons. Use the Avenue
'explode' method to break a multipolygon into a list of polygons. Then
for each polygon use the 'aslist' method to get a list of list of points.

for each poly in theShape.explode
   ' these are your multipoly parts
   for each ring in poly.aslist
   ' these are your rings
     for each pt in ring
       ' these are coordinates
     end
   end
end


Paul Ramsey wrote:

> Sean,
>
> Change your script, it's not writing things out right... you are writing
> MULTIPOLYGON parts instead of POLYGON parts. If you wrote polygon parts,
> the hole would be a hole instead of another polygon...
>
> MULTIPOLYGON(((-244339 1210399, -244339
> 1541250, 21058 1541250, 21058 1210399, -244339 1210399),(-39283
> 1521307, -57692 1518238, -64340 1511591, -62805 1497784, -54112
> 1494716, -45931 1494716, -40306 1494204, -38260 1493693, -34681 1482443,
> -42862 1471705, -50021 1460966, -51044 1448182, -41840 1437955, -27522
> 1431307, -8601 1422614, 603 1409318, 92 1392955, -13715 1377103, -46953
> 1370455, -68942 1365341, -91442 1342841, -91442 1309092, -81726 1303467,
> -2976 1329546, 13899 1358182, 14921 1431818, -7067 1513125, -39283
> 1521307)))
>
> Note: "),(" instead of ")),((". Double note: Arcview *does* support
> multipolygons, so you have to write those out correctly too (otherwise
> you'll create more invalid geometries, by treating multiparts as holes).
>
> Paul
>
> Sean M. Montague wrote:
>
>> It's a hole.  It should be valid...I think.  What about islands in a
>> lake?  The only time I have a problem with them is when I intersect one.
>>
>> -----Original Message-----
>> From: [hidden email]
>> [mailto:[hidden email]] On Behalf Of Paul
>> Ramsey
>> Sent: Tuesday, June 07, 2005 11:35 AM
>> To: PostGIS Users Discussion
>> Subject: Re: [postgis-users] Intersection errors
>>
>> It's not valid, because legal multipolygons do not have parts that
>> interact. Your multipolygon has two parts and one is completely
>> contained in the other. No cookie for you!
>>
>> Paul
>>
>> Sean M. Montague wrote:
>>
>>> Correct, below is the insert statement I construct from AV 3 using
>>> Avenue.  I'm not sure about the isvalid.  Is that what you get when
>>> trying to insert it?  Thanks.
>>>
>>> Sean
>>>
>>> INSERT INTO "test_02" ("objectid","name","layer","the_geom") VALUES
>>> ('3','3','3',GeometryFromText('MULTIPOLYGON(((-244339 1210399, -244339
>>> 1541250, 21058 1541250, 21058 1210399, -244339 1210399)),((-39283
>>> 1521307, -57692 1518238, -64340 1511591, -62805 1497784, -54112
>>
>>
>> 1494716,
>>
>>> -45931 1494716, -40306 1494204, -38260 1493693, -34681 1482443, -42862
>>> 1471705, -50021 1460966, -51044 1448182, -41840 1437955, -27522
>>
>>
>> 1431307,
>>
>>> -8601 1422614, 603 1409318, 92 1392955, -13715 1377103, -46953
>>
>>
>> 1370455,
>>
>>> -68942 1365341, -91442 1342841, -91442 1309092, -81726 1303467, -2976
>>> 1329546, 13899 1358182, 14921 1431818, -7067 1513125, -39283
>>> 1521307)))',32767))
>>>
>>>
>>> -----Original Message-----
>>> From: [hidden email]
>>> [mailto:[hidden email]] On Behalf Of
>>> Darren Houston
>>> Sent: Monday, June 06, 2005 8:30 PM
>>> To: PostGIS Users Discussion
>>> Subject: Re: [postgis-users] Intersection errors
>>>
>>> Hi Sean,
>>>
>>> I'm correct in assuming the multipolygon posted is the geometry at
>>> layer=3? I received a false isvalid on that multipolygon.
>>>
>>> 'POSTGIS="1.0.1" GEOS="3.0.0" PROJ="Rel. 4.4.9, 29 Oct 2004" USE_STATS
>>
>>
>>
>>> DBPROC="0.3.0" RELPROC="0.3.0"'
>>>
>>> I'm in a rush, but I promise to look at it more tomorrow.
>>>
>>> Darren H.
>>> _______________________________________________
>>> postgis-users mailing list
>>> [hidden email]
>>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
>>
>>
>> _______________________________________________
>> postgis-users mailing list
>> [hidden email]
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
> _______________________________________________
> postgis-users mailing list
> [hidden email]
> http://postgis.refractions.net/mailman/listinfo/postgis-users

_______________________________________________
postgis-users mailing list
[hidden email]
http://postgis.refractions.net/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|

RE: Intersection errors

Sean M. Montague
In reply to this post by Sean M. Montague
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.

Sean

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Paul
Ramsey
Sent: Tuesday, June 07, 2005 12:38 PM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] Intersection errors

Just to complete the discussion on multipolygons. Use the Avenue
'explode' method to break a multipolygon into a list of polygons. Then
for each polygon use the 'aslist' method to get a list of list of
points.

for each poly in theShape.explode
   ' these are your multipoly parts
   for each ring in poly.aslist
   ' these are your rings
     for each pt in ring
       ' these are coordinates
     end
   end
end


Paul Ramsey wrote:

> Sean,
>
> Change your script, it's not writing things out right... you are
writing
> MULTIPOLYGON parts instead of POLYGON parts. If you wrote polygon
parts,
> the hole would be a hole instead of another polygon...
>
> MULTIPOLYGON(((-244339 1210399, -244339
> 1541250, 21058 1541250, 21058 1210399, -244339 1210399),(-39283
> 1521307, -57692 1518238, -64340 1511591, -62805 1497784, -54112
> 1494716, -45931 1494716, -40306 1494204, -38260 1493693, -34681
1482443,
> -42862 1471705, -50021 1460966, -51044 1448182, -41840 1437955, -27522
> 1431307, -8601 1422614, 603 1409318, 92 1392955, -13715 1377103,
-46953
> 1370455, -68942 1365341, -91442 1342841, -91442 1309092, -81726
1303467,
> -2976 1329546, 13899 1358182, 14921 1431818, -7067 1513125, -39283
> 1521307)))
>
> Note: "),(" instead of ")),((". Double note: Arcview *does* support
> multipolygons, so you have to write those out correctly too (otherwise

> you'll create more invalid geometries, by treating multiparts as
holes).
>
> Paul
>
> Sean M. Montague wrote:
>
>> It's a hole.  It should be valid...I think.  What about islands in a
>> lake?  The only time I have a problem with them is when I intersect
one.
>>
>> -----Original Message-----
>> From: [hidden email]
>> [mailto:[hidden email]] On Behalf Of
Paul

>> Ramsey
>> Sent: Tuesday, June 07, 2005 11:35 AM
>> To: PostGIS Users Discussion
>> Subject: Re: [postgis-users] Intersection errors
>>
>> It's not valid, because legal multipolygons do not have parts that
>> interact. Your multipolygon has two parts and one is completely
>> contained in the other. No cookie for you!
>>
>> Paul
>>
>> Sean M. Montague wrote:
>>
>>> Correct, below is the insert statement I construct from AV 3 using
>>> Avenue.  I'm not sure about the isvalid.  Is that what you get when
>>> trying to insert it?  Thanks.
>>>
>>> Sean
>>>
>>> INSERT INTO "test_02" ("objectid","name","layer","the_geom") VALUES
>>> ('3','3','3',GeometryFromText('MULTIPOLYGON(((-244339 1210399,
-244339
>>> 1541250, 21058 1541250, 21058 1210399, -244339 1210399)),((-39283
>>> 1521307, -57692 1518238, -64340 1511591, -62805 1497784, -54112
>>
>>
>> 1494716,
>>
>>> -45931 1494716, -40306 1494204, -38260 1493693, -34681 1482443,
-42862

>>> 1471705, -50021 1460966, -51044 1448182, -41840 1437955, -27522
>>
>>
>> 1431307,
>>
>>> -8601 1422614, 603 1409318, 92 1392955, -13715 1377103, -46953
>>
>>
>> 1370455,
>>
>>> -68942 1365341, -91442 1342841, -91442 1309092, -81726 1303467,
-2976

>>> 1329546, 13899 1358182, 14921 1431818, -7067 1513125, -39283
>>> 1521307)))',32767))
>>>
>>>
>>> -----Original Message-----
>>> From: [hidden email]
>>> [mailto:[hidden email]] On Behalf Of
>>> Darren Houston
>>> Sent: Monday, June 06, 2005 8:30 PM
>>> To: PostGIS Users Discussion
>>> Subject: Re: [postgis-users] Intersection errors
>>>
>>> Hi Sean,
>>>
>>> I'm correct in assuming the multipolygon posted is the geometry at
>>> layer=3? I received a false isvalid on that multipolygon.
>>>
>>> 'POSTGIS="1.0.1" GEOS="3.0.0" PROJ="Rel. 4.4.9, 29 Oct 2004"
USE_STATS

>>
>>
>>
>>> DBPROC="0.3.0" RELPROC="0.3.0"'
>>>
>>> I'm in a rush, but I promise to look at it more tomorrow.
>>>
>>> Darren H.
>>> _______________________________________________
>>> postgis-users mailing list
>>> [hidden email]
>>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
>>
>>
>> _______________________________________________
>> postgis-users mailing list
>> [hidden email]
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
> _______________________________________________
> postgis-users mailing list
> [hidden email]
> http://postgis.refractions.net/mailman/listinfo/postgis-users

_______________________________________________
postgis-users mailing list
[hidden email]
http://postgis.refractions.net/mailman/listinfo/postgis-users
_______________________________________________
postgis-users mailing list
[hidden email]
http://postgis.refractions.net/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|

Re: Intersection errors

Markus Schaber-7
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
[hidden email]
http://postgis.refractions.net/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|

RE: Intersection errors

Ethan Alpert
In reply to this post by Sean M. Montague


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: [hidden email]
[mailto:[hidden email]] 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 [hidden email]
http://postgis.refractions.net/mailman/listinfo/postgis-users
_______________________________________________
postgis-users mailing list
[hidden email]
http://postgis.refractions.net/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|

RE: Intersection errors

Sean M. Montague
In reply to this post by Sean M. Montague
Oh my brain!  So many if statements.  I have successfully rewritten my
script so that it correctly inputs MULTIPOLYGONS and distinguishes
between holes and other polys.  This also seems to have corrected my
intersection problem, although I will test more robustly tomorrow.
Thank you for everyone's help.

Sean

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] 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
[hidden email]
http://postgis.refractions.net/mailman/listinfo/postgis-users
_______________________________________________
postgis-users mailing list
[hidden email]
http://postgis.refractions.net/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|

RE: Intersection errors

Sean M. Montague
In reply to this post by Sean M. Montague
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: [hidden email]
[mailto:[hidden email]] 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: [hidden email]
[mailto:[hidden email]] 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 [hidden email]
http://postgis.refractions.net/mailman/listinfo/postgis-users
_______________________________________________
postgis-users mailing list
[hidden email]
http://postgis.refractions.net/mailman/listinfo/postgis-users
_______________________________________________
postgis-users mailing list
[hidden email]
http://postgis.refractions.net/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|

RE: Intersection errors

Ethan Alpert
In reply to this post by Sean M. Montague

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: [hidden email]
[mailto:[hidden email]] 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: [hidden email]
[mailto:[hidden email]] 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: [hidden email]
[mailto:[hidden email]] 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 [hidden email]
http://postgis.refractions.net/mailman/listinfo/postgis-users
_______________________________________________
postgis-users mailing list [hidden email]
http://postgis.refractions.net/mailman/listinfo/postgis-users
_______________________________________________
postgis-users mailing list [hidden email]
http://postgis.refractions.net/mailman/listinfo/postgis-users
_______________________________________________
postgis-users mailing list
[hidden email]
http://postgis.refractions.net/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|

Re: Intersection errors

joshli
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-----
[[hidden email]] 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-----
[[hidden email]] 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-----
[[hidden email]] 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 [hidden email]
_______________________________________________
postgis-users mailing list [hidden email]
_______________________________________________
postgis-users mailing list [hidden email]
_______________________________________________
postgis-users mailing list



_______________________________________________
postgis-users mailing list
[hidden email]
http://postgis.refractions.net/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|

Re: Intersection errors

strk
In reply to this post by Ethan Alpert
On Tue, Jun 07, 2005 at 02:05:05PM -0600, Ethan Alpert wrote:
>
>
> 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?

There's an area computation algorithms that accidentally return
direction of rings (sign of result gives it).
After having found outer and inner rings the shp2pgsql tries
to couple each hole with a shell.

--strk;

>
>
>
> -e
>
> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] 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 [hidden email]
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> _______________________________________________
> postgis-users mailing list
> [hidden email]
> http://postgis.refractions.net/mailman/listinfo/postgis-users
_______________________________________________
postgis-users mailing list
[hidden email]
http://postgis.refractions.net/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|

Re: Intersection errors

Markus Schaber-7
In reply to this post by Ethan Alpert
Hi, Ethan,

Ethan Alpert wrote:
>
> 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?

If you need a really stable algorithm, current JTS releases contain a
polygonize function that converts arbitrary linework into polygons. This
should work without any dependencies on ring order or clockwise
ordinates, but I suspect this to be rather inefficient.

Markus


_______________________________________________
postgis-users mailing list
[hidden email]
http://postgis.refractions.net/mailman/listinfo/postgis-users
12