轉自:http://blog.csdn.net/familyshizhouna/article/details/68944683git
參考:http://blog.csdn.net/qwlovedzm/article/details/5337662sql
投影座標系(PCS):http://support.supermap.com.cn/DataWarehouse/WebDocHelp/iServer/Appendix/CoordSystem/PCS_Code.htmide
ps:sql語句中註釋掉的32774是座標系代碼.而sql語句中默認使用的座標系是nullspa
--create table create table t5( id number, location sdo_geometry --點 ); --插入空間元數據 insert into user_sdo_geom_metadata (table_name,column_name,srid,diminfo) values ( 't5', 'location', NULL,--32774, sdo_dim_array ( sdo_dim_element ( 'longitude', -180, 180, 0.1 ), sdo_dim_element ( 'latitude', -90, 90, 0.1 ) ) ); --創建空間索引 create index test5_index on t5(location) indextype is mdsys.spatial_index; --插入數據1 insert into t5 values( 1, --id sdo_geometry ( 2001, --32774, NULL, SDO_POINT_TYPE(-33,40,NULL), NULL, NULL ) ); --查詢表T5中的點是否在給定的多邊形中 select * from T5 where sdo_inside("LOCATION", SDO_GEOMETRY( 2003, -- two-dimensional polygon NULL,--32774, NULL, sdo_elem_info_array (1,2003,2), SDO_ORDINATE_ARRAY(-122.526398,40.708813, -122.526398,40.822802, 40.822802,-122.373962, -122.373962,40.708813, -122.526398,40.708813) --多邊形 ))='TRUE'; select * from T5 where sdo_relate("LOCATION", SDO_GEOMETRY( 2003, -- two-dimensional polygon NULL ,--32774, NULL, sdo_elem_info_array (1,2003,2), SDO_ORDINATE_ARRAY(-122.526398,40.708813, -122.526398,40.822802, 40.822802,-122.373962, -122.373962,40.708813, -122.526398,40.708813) --多邊形 ) ,'MASK=INSIDE')='TRUE';