如果打算使用Oracle Spatial来存储或处理多边形,则需要将数据存储为SDO_GEOMETRY
对象。这是一个简单的例子:
CREATE TABLE my_polygons (
id INTEGER
, polygon sdo_geometry
)
/
INSERT INTO my_polygons (
id
, polygon
)
VALUES (
1
, sdo_geometry (
2003 -- 2D Polygon
, 4326 -- wgs84, the typical GPS coordinate system
, NULL -- sdo_point_type, should be NULL if sdo_ordinate_array specified
, sdo_elem_info_array(
1 -- First ordinate position within ordinate array
, 1003 -- Exterior polygon
, 1 -- All polygon points are specified in the ordinate array
)
, sdo_ordinate_array(
80.16397166, 27.54798833,
, 80.16450166, 27.547766,
, 80.164701, 27.548131,
, 80.16397166, 27.54798833
)
)
)
/
这里有关于对象类型的不同标志的更多信息:http ://docs.oracle.com/cd/B19306_01/appdev.102/b14255/sdo_objrelschema.htm
需要注意的关键事项: