数据库
首页 > 数据库> > oracle spatial创建空间表、元数据

oracle spatial创建空间表、元数据

作者:互联网

这样就能在idesktop中看到数据源了。

CREATE TABLE us_restaurants_new
(
id NUMBER,
poi_name VARCHAR2(32),
location MDSYS.SDO_GEOMETRY -- New column to store locations
);

--插入元数据
insert into user_sdo_geom_metadata(TABLE_NAME,COLUMN_NAME
,DIMINFO,SRID) values(
'us_restaurants_new',
'location',
mdsys.sdo_dim_array(
MDSYS.SDO_DIM_ELEMENT('x',70.000000000,140.000000000,0.000000050),
MDSYS.SDO_DIM_ELEMENT('y',0.000000000,60.000000000,0.000000050)),
8307--SRID
);

 

INSERT INTO us_restaurants_new VALUES
(
1,
'PIZZA HUT',
SDO_GEOMETRY
(
2001, -- SDO_GTYPE attribute: "2" in 2001 specifies dimensionality is 2.
NULL, -- other fields are set to NULL.
SDO_POINT_TYPE -- Specifies the coordinates of the point
(
-87, -- first ordinate, i.e., value in longitude dimension
-78, -- second ordinate, i.e., value in latitude dimension
NULL -- third ordinate, if any
),
NULL,
NULL
)
);

标签:NULL,创建,us,ordinate,MDSYS,spatial,oracle,new,SDO
来源: https://www.cnblogs.com/yansc/p/12098561.html