Oracle 点线面关系 空间分析
请保证有oracle 创建SDO_Geometry表基础上在来看此文
sdo_Geom.Relate(sdo_Geometry1, ‘MASK’, sod_Geometry2, tolerance ):用于判断一个几何体与另一个几何体的关系,我们用于判断当前点是否在某一个面(省份面、县市面、乡镇面)上。
参数说明:
sdo_Geometry1,sdo_Geometry2为空间数据对应的几何对象。
Tolerance: 容许的精度范围;
— Return the topological intersection of two geometries.
SELECT SDO_GEOM.SDO_INTERSECTION(c_a.shape, c_c.shape, 0.005)
FROM cola_markets c_a, cola_markets c_c
WHERE c_a.name = ‘cola_a‘ AND c_c.name = ‘cola_c‘;
— Do two geometries have any spatial relationship?
SELECT SDO_GEOM.RELATE(c_b.shape, ‘anyinteract‘, c_d.shape, 0.005)
FROM cola_markets c_b, cola_markets c_d
WHERE c_b.name = ‘cola_b‘ AND c_d.name = ‘cola_d‘;
— Return the areas of all cola markets.
SELECT name, SDO_GEOM.SDO_AREA(shape, 0.005) FROM cola_markets;
— Return the area of just cola_a.
SELECT c.name, SDO_GEOM.SDO_AREA(c.shape, 0.005) FROM cola_markets c
WHERE c.name = ‘cola_a‘;
— Return the distance between two geometries.
SELECT SDO_GEOM.SDO_DISTANCE(c_b.shape, c_d.shape, 0.005)
FROM cola_markets c_b, cola_markets c_d
WHERE c_b.name = ‘cola_b‘ AND c_d.name = ‘cola_d‘;
— Is a geometry valid?
SELECT c.name, SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT(c.shape, 0.005)
FROM cola_markets c WHERE c.name = ‘cola_c‘;
— Is a layer valid? (First, create the results table.)
CREATE TABLE val_results (sdo_rowid ROWID, result VARCHAR2(2000));
CALL SDO_GEOM.VALIDATE_LAYER_WITH_CONTEXT(‘COLA_MARKETS‘, ‘SHAPE‘,
‘VAL_RESULTS‘, 2);
SELECT * from val_results;
常用sql函数:
MASK参数:
Anyinteract: sdo_Geometry2落在sdo_Geometry1面上包括在边上。
Contains: sdo_Geometry2完全包含在sdo_Geometry1几何对象中,并且两个几何对象的边没有交叉。
Coveredby: sdo_Geometry1完全包含在sdo_Geometry2中,并且这两个几何对象的边有一个或多个点相互重叠。
Covers: sdo_Geometry2完全包含在sdo_Geometry1中,并且这两个几何对象的边有一个或多个点相互重叠。
Disjoint: 两个几何没有重叠交叉点,也没有共同的边。
Equal: 两个几何是相等的。
Inside: sdo_Geometry1完全包含在sdo_Geometry2几何对象中,并且两个几何对象的边没有交叉。
On: sdo_Geometry1的边和内部的线完全在sdo_Geometry2上。
Overlapbdydisjoint: 两个几何对象交迭,但是边没有交叉。
Overlapbdyintersect: 两个几何对象交迭,并且边有部分交叉。
Touch: 两个几何对象有共同的边,但没有交叉。
转载自:https://blog.csdn.net/coder_giser/article/details/24333405