创建、插入空间信息表
对经纬度坐标,坐标系统一定要用 8307, 否则结果不正确!
CREATE TABLE MyGeom
(
id NUMBER,
name VARCHAR2(35),
geom SDO_GEOMETRY
);
插入圆形
INSERT INTO MyGeom VALUES
(
1,
'圆形',
SDO_GEOMETRY
(
2003, -- SDO_GTYPE: 二维多边形
8307, -- 大地坐标
NULL, -- SDO_POINT_TYPE is null
SDO_ELEM_INFO_ARRAY -- SDO_ELEM_INFO attribute (see Table 4-2 for values)
(
1, -- Offset is 1
1003, -- 多边形
4 -- 圆形
),
SDO_ORDINATE_ARRAY -- SDO_ORDINATES attribute
(
111.788889,28.318333,
112.633783,28.315394,
112.291389,27.621667
)
)
);
插入多边形
INSERT INTO MyGeom VALUES
(
2,
'多边形',
SDO_GEOMETRY
(
2003, -- SDO_GTYPE: 二维多边形
8307, -- 大地坐标系
NULL, -- SDO_POINT_TYPE is null
SDO_ELEM_INFO_ARRAY -- SDO_ELEM_INFO attribute (see Table 4-2 for values)
(
1, -- Offset is 1
1003, -- 多边形
1 -- Interpretation is 1 if line string is connected by straight lines.
),
SDO_ORDINATE_ARRAY -- SDO_ORDINATES attribute
(
112.291389,27.621667,
112.633333,26.908333,
112.358333,25.561667,
111.340000,25.276667,
109.316667,26.583333,
109.355833,27.882500,
111.788889,28.318333,
112.291389,27.621667
)
)
);