時間:2023-05-07 15:45:02 | 來源:網(wǎng)站運營
時間:2023-05-07 15:45:02 來源:網(wǎng)站運營
【第五章 空間數(shù)據(jù)庫】達夢數(shù)據(jù)庫DMGEO 包:隨著政府項目對信創(chuàng)要求的不斷推進,國產(chǎn)化數(shù)據(jù)庫也大勢所趨,很多項目要求使用達夢數(shù)據(jù)庫。數(shù)據(jù)庫遷移的過程中,對于空間數(shù)據(jù)的支持也是非常重要的一項內(nèi)容。#插入要素INSERT INTO testdmgeo VALUES(1,'test1',dmgeo.ST_PolyFromText('polygon((114 22,114.5 22,114.5 22.5,114 22.5,114 22))',4326));#計算面積,直接根據(jù)坐標系統(tǒng)單位計算select dmgeo.ST_Area(dmgeo.ST_PolyFromText('polygon((114 22,114.5 22,114.5 22.5,114 22.5,114 22))',4326));0.25#距離也一樣select dmgeo.ST_Distance(dmgeo.ST_PointFromText('point(113 22)',4326),dmgeo.ST_PolyFromText('polygon((114 22,114.5 22,114.5 22.5,114 22.5,114 22))',4326)); 1.0#進行投影轉(zhuǎn)換后,返回平面坐標值,單位是米select dmgeo.ST_Area(dmgeo.ST_TRANSFORM(dmgeo.ST_PolyFromText('polygon((114 22,114.5 22,114.5 22.5,114 22.5,114 22))',4326),4547))2.8536572519374533E9#生成geojsonselect dmgeo.ST_AsGEOJSON(dmgeo.ST_PointFromText('point(113 22)',4326)){"type": "Point","crs":{"type":"name","properties":{"name":"EPSG:4326"}},"coordinates":[[113.000000000000000,22.000000000000000]]}#判斷是否相交select dmgeo.ST_Intersects(dmgeo.ST_PointFromText('point(113 22)',4326),dmgeo.ST_PolyFromText('polygon((114 22,114.5 22,114.5 22.5,114 22.5,114 22))',4326));0
(4)空間索引CREATE TABLE testdmgeo(id int, name varchar(20), geom ST_polygon); create spatial index idxtestdmspatial on testdmgeo(geom);
(5)空間數(shù)據(jù)入庫關(guān)鍵詞:數(shù)據(jù),空間
微信公眾號
版權(quán)所有? 億企邦 1997-2025 保留一切法律許可權(quán)利。