Oracle空间数据简单使用
空间操作符:
sdo_Geom.Relate(sdo_Geometry1, ‘MASK’, sod_Geometry2, tolerance ):用于判断一个几何体与另一个几何体的关系,我们用于判断当前点是否在某一个面(省份面、县市面、乡镇面)上。
参数说明:
sdo_Geometry1,sdo_Geometry2为空间数据对应的几何对象。
Tolerance: 容许的精度范围;
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: 两个几何对象有共同的边,但没有交叉。
coordinate:坐标点数组
String sql = "insert into ZDYYCLDTJG_YW.T_ELECTRONIC_FENCE" +
" (FEATURE_ID,NAMES,FEATURE_TYPE,NOTE,SHAPE)" +
"values ('" +id+"'," +
" '"+name+"'," +
" '"+type+"'," +
" '"+explain+"'," +
" mdsys.sdo_geometry(" +
" 2003," +
" 8307," +
" null," +
" mdsys.sdo_elem_info_array(1,1003,1)," +
" mdsys.SDO_ORDINATE_array( "+coordinate+" )" +
" )" +
")";
String sql = " SELECT B.*" +
" FROM USER_AQYJ_ZH.CL_LKYW_GPS_DAY B" +
" WHERE POSTIME >= '"+getTimeByMinute(-10)+"' and SDO_GEOM.RELATE(mdsys.sdo_geometry(2003," +
" 8307," +
" null," +
" mdsys.sdo_elem_info_array(1," +
" 1003," +
" 1)," +
" mdsys.SDO_ORDINATE_array( "+coordinate+" ))," +
" 'ANYINTERACT'," +
" MDSYS.SDO_GEOMETRY(2001," +
" 8307," +
" SDO_POINT_TYPE(B.NEW_LONGITUDE," +
" B.NEW_LATITUDE," +
" NULL)," +
" NULL," +
" NULL)," +
" 0.5) = 'TRUE'";
转载自:https://blog.csdn.net/qq_37279783/article/details/82224732