c#读写SDO_GEOMETRY字段

查询语句

selectdb.SHAPE.SDO_gtype as SDO_gtype,
   db.shape.sdo_srid as sdo_srid,
   db.shape.sdo_point.x as point_x,
   db.shape.sdo_point.y as point_y,
   db.shape.sdo_point.z as point_z,
   db.shape.sdo_elem_info as elem_info,
   db.shape.sdo_ordinates as sdo_ordinates
from T_table db

regexp_replace(sdo_util.to_gmlgeometry(db.shape),'</?[^>]*>|nbsp;|&','') as ORDINATES

插入字段值

INSERT INTO T_table (ID,SHAPE) VALUES(
          '10000000003',         
          MDSYS.SDO_GEOMETRY( 
                      2003,
                      NULL,
                      NULL,
                      MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,3,3,22),
                      MDSYS.SDO_ORDINATE_ARRAY(1,1, 5,7)

         )
 );

读取字段

select db.id as region_id, sdo_util.to_gmlgeometry(db.shape) as region_location from T_table db

 获取类型

select db.shape.get_gtype() from T_table db

select db.SHAPE.SDO_gtype from T_table db

 条件查询

selectdb.objectid,
       TO_CHAR(db.shape.get_wkt()) AS wkt,
       db.comp_type,
       db.datatype,
       db.comp_name,
       db.health_lic,
       db.shape.SDO_POINT.X as x,
       db.shape. SDO_POINT.Y as y,
       db.reg_addr,
       db.bus_addr
  from t_publicplaces db
 where 1 = 1
   and substr(db.comp_type, 0, 2) = '01'
   and sdo_within_distance(db.SHAPE,
                           SDO_GEOMETRY(2001,
                                        8307,
                                        SDO_POINT_TYPE(116.4, 39.9, NULL),
                                        NULL,
                                        NULL),
                           'distance=1500.0 unit=m') = 'TRUE'

SELECT
   /*轨迹SHAPE信息 */
   db.id,
   db.SHAPE.SDO_gtype as SDO_gtype,
   db.shape.sdo_srid as sdo_srid,
   db.shape.sdo_point.x as point_x,
   db.shape.sdo_point.y as point_y,
   db.shape.sdo_point.z as point_z,
   '' as elem_info,
   /*
   db.shape.sdo_elem_info as elem_info,
   db.shape.sdo_ordinates as sdo_ordinates,
   sdo_util.to_gmlgeometry(db.shape) as sdo_ordinates
   */
   regexp_replace(sdo_util.to_gmlgeometry(db.shape),'</?[^>]*>|nbsp;|&','') as ORDINATES

FROM T_DEVICESTRACK db;

本博客有部分内容来自网络,如有问题请联系:hebeilijianghua@qq.com,并注明来自博客园。
原文地址:https://www.cnblogs.com/leebokeyuan/p/8861714.html