时间:2023-05-07 15:45:02 | 来源:网站运营
时间:2023-05-07 15:45:02 来源:网站运营
【第五章 空间数据库】达梦数据库DMGEO 包:随着政府项目对信创要求的不断推进,国产化数据库也大势所趋,很多项目要求使用达梦数据库。数据库迁移的过程中,对于空间数据的支持也是非常重要的一项内容。#插入要素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));#计算面积,直接根据坐标系统单位计算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#进行投影转换后,返回平面坐标值,单位是米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)空间数据入库关键词:数据,空间