calculating sdo_intersection between all rows in one table
394610Sep 20 2005 — edited Oct 21 2005Hi there. I have constructed a simple spatial table containing sdo_polygon geometry objects. At present the table comprises only 11 rows. I have no problem measuring the area of intersection between all 11 geometries in my spatial table and a specific static geometry object. For this my query looks as follows:
select session_id, frame_id, SDO_GEOM.SDO_AREA(
SDO_GEOM.SDO_INTERSECTION(frame_boundary,
sdo_cs.viewport_transform(MDSYS.SDO_GEOMETRY(2003,0,null,
MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,3),
MDSYS.SDO_ORDINATE_ARRAY(-105.00981,39.836784,-104.79018,39.963158)),8265),
0.005), 0.005) computed_area from joeweaker.session_interest_frames
where user_id = 1023;
However, what I am trying to do is to measure the area of intersection between all possible pair combinations of sdo_polygon objects contained in my spatial table. Hence there should be 55 values returned, i.e. intersection row 1 & row 2, row 1 & row 3, row 1 & row 4,...., row 1 & row 11, row 2 & row 3,...., row 10 & row 11, i.e. I am only measuring the intersection of each pair of polygons once. My only attempt thus far has been executing the following query which only returns 11 values, 1 for each row in the table:
select session_id, frame_id, SDO_GEOM.SDO_AREA(
SDO_GEOM.SDO_INTERSECTION(frame_boundary, frame_boundary,
0.005), 0.005) computed_area from joeweaker.session_interest_frames
where user_id = 1023;
I understand that the above is not going to work. I think I need a nested loop inside the select statement. Can anybody give me some support on constructing the correct sql statement to get the correct results. Thnaks a lot, Joe