[postgis-users] Intersection errors

Paul Ramsey pramsey at refractions.net
Tue Jun 7 11:38:08 PDT 2005


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: postgis-users-bounces at postgis.refractions.net
>> [mailto:postgis-users-bounces at postgis.refractions.net] 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: postgis-users-bounces at postgis.refractions.net
>>> [mailto:postgis-users-bounces at postgis.refractions.net] 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
>>> 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




More information about the postgis-users mailing list