开启达梦数据库空间函数功能

按图所示开启工具包这个

 第二步开始空间函数之旅 提供几个SQL样例

--geo测试
-- #插入要素
--INSERT  INTO testgeo VALUES(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
--#生成geojson
--select 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));

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值