SDO_RELATE和SDO_GEOM.RELATE

SDO_RELATE需要事先建立索引,而SDO_GEOM.RELATE不用。

SDO_RELATE返回True或False,

SDO_GEOM.RELATE除可返回True或False外,还可返回关系(当mask设为'determine'时)。

    select z.id1,z.id2,
    SDO_RELATE (s1.geom, s2.geom,'mask=TOUCH+OVERLAPBDYDISJOINT+OVERLAPBDYINTERSECT') sdo_relate,
            SDO_GEOM.RELATE(s1.geom,'determine',s2.geom,0.5) relation,
            to_char(regexp_replace(sdo_util.to_gmlgeometry(z.intsxn_geom),'</?[^>]*>|nbsp;|&','')) zc,
            to_char(regexp_replace(sdo_util.to_gmlgeometry(s1.geom),'</?[^>]*>|nbsp;|&','')) sc1,
            to_char(regexp_replace(sdo_util.to_gmlgeometry(s2.geom),'</?[^>]*>|nbsp;|&','')) sc2
            from SALES_INTERSECTION_ZONES z, sales_regions s1,sales_regions s2
            where z.id1=s1.id
            and z.id2=s2.id

-- Listing 9-15. RELATE Function Complementing the SDO_RELATE Operator
SELECT sra.id,
SDO_GEOM.RELATE(sra.geom, 'DETERMINE', srb.geom, 0.5) relationship
FROM sales_regions srb, sales_regions sra
WHERE srb.id=51
AND sra.id<>51
AND SDO_RELATE (
  sra.geom, srb.geom,
 'mask=TOUCH+OVERLAPBDYDISJOINT+OVERLAPBDYINTERSECT'
) = 'TRUE'
ORDER BY sra.id;

 

posted on 2019-05-14 10:37  mol1995  阅读(1916)  评论(0编辑  收藏  举报

导航