[postgis-users] [postgis-devel] St_Intersection on same table

Paragon Corporation lr at pcorp.us
Fri Apr 23 12:48:16 PDT 2010


Rafal,

This question is more appropriate for the PostGIS User's group rather than
the PostGIS developer's group. 

To answer your question -- We are suspecting you will want to do a SELF JOIN
accompanied by a ST_Union, ST_Intersection, and/or possibly a
ST_SymDifference.

What is unclear to us is 

If you have 3 polygons - lets say 1,2,3

1 intersects with 2
2 intersects with 3 (but not with 1)

What are you expecting to happen here?
A) intersection(1,2)  count 2, Intersection(2,3) count 2

Or

B) You don't allow the same geometry to be counted twice in which case
You throw out the whole thing  return the empty set

Or

C) You arbitrarily pick a set and return intersection (1,2)

----

D) Similarly we assume if you have a case where 1,2,3 all intersect then you
would return

ST_Intersection(ST_Intersection(1,2),3), count 3 ? 

Or

Would you treat as a pairwise intersection

E) 1,2,3 x 1,2, 3 intesection resutling in  3 records with count of 2 each

1,2 
2,3
1,3

Leo and Regina
http://www.postgis.us


-----Original Message-----
From: postgis-devel-bounces at postgis.refractions.net
[mailto:postgis-devel-bounces at postgis.refractions.net] On Behalf Of Rafal
Foltynski
Sent: Friday, April 23, 2010 11:32 AM
To: postgis-devel at postgis.refractions.net
Subject: [postgis-devel] St_Intersection on same table

Hi,

I have a table with many overlying polygons.  I want to create a new polygon
relation from the intersection of these polygons that has two fields 1.
geometry of small polygons - the result of St_Intersection() and 2. count of
the number of overlying polygons that each small polygon was created from.
How do I create a query to run St_Intersect on the same geometry field in
one table?

For example: if I have a table with 3 polygons, 2 of them share a small area
and the third polygon is disjoint, the resulting polygon relation would only
have one small polygon area (shared area between two polygons) and count of
2.   

Rafal    


      
_______________________________________________
postgis-devel mailing list
postgis-devel at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-devel





More information about the postgis-users mailing list