mysql sde_sde用sql实现erase_MySQL

概述:

本文讲述基于Arc SDE forOracle实现erase空间分析计算。

实现流程:

144P204Q2A60-5F14.jpg

1、叠加计算

判断叠加,非叠加部分即为一部分所要结果,叠加部分进入第二步;

2、合并计算

根据objectid进行union计算;

3、差异计算

用原始数据data1和合并计算后的结果进行差异计算,所得的结果即为另一部分所要结果。

相关sde函数介绍:

1、sde.st_intersection(st_geometryshape1, st_geometry shape2)

语法:

参数:(st_geometry shape1, st_geometryshape2)

返回值:st_geometry shape

解释:

Returns a geometry that represents the shared portion of shape1 andshape2.

示意:

144P204Q53120-E1S.jpg

2、sde.st_union(st_geometryshape1, st_geometry shape2)

语法:

参数:(st_geometry shape1, st_geometryshape2)

返回值:st_geometry shape

解释:

Returns a geometry that represents the point set union of theGeometries.

示意:

144P204Q6250-IW2.jpg

3、sde.st_difference(st_geometryshape1, st_geometry shape2)

语法:

参数:(st_geometry shape1, st_geometryshape2)

返回值:st_geometry shape

解释:

Returns a geometry thatrepresents that part of geometry A that does not intersect with geometry B.

示意:

144P204QL560-W3M.jpg

说明:

看到图3,很多人就开始问了:erase的效果不就是图3的效果吗,为什么还要那么多步?是的,对于两两的geometry来说,difference结果即为我们想要的erase的结果,但是,对于两个图层来说,difference后的结果是整个data2的结果,并且结果中会有一些叠加与重复。为什么会出现这样的结果呢,我想sde的算法实现中,也是两两做的计算,因此,计算的结果就是整个data2的结果。举例:A为data1的一个要素,B、C分别为data2的两个要素,在sde中,difference计算的结果为图4,1和2分别为计算后的结果,并重叠在一起显示,但是实际中,我们想要的及全国是图5。

144P204QZ620-93322.jpg

图4

144P204R04E0-10Y36.jpg

图5

实现sql实例:

1、计算叠加insert intohx2q_risk_result_temp(objid,shape)

select *

from (select a.objectid,sde.st_intersection(a.shape, b.shape) as shape

from hx2q_project a, hx2q_landnormb

where a.ptcode = 'm01'

and b.ptcode = 'm01'

and a.status = '开工'

and b.confirm = '已取得'

and a.flag = 0

and b.flag = 0)

where sde.st_area(shape) > 0

2、计算union

3、计算differenceinsert intoHX2Q_RISK_RESULT

(objid, ptcode, Shape, objectid)

select a.objectid,

a.ptcode,

sde.st_difference(a.shape, b.shape) asshape,

SDE.version_user_ddl.NEXT_ROW_ID('HX2Q','36') as objectid

from hx2q_project a, hx2q_risk_result_temp b

where a.objectid = b.objid

4、获取非叠加insert intoHX2Q_RISK_RESULT

(objid, ptcode, Shape, objectid)

select objectid,

ptcode,

shape,

SDE.version_user_ddl.NEXT_ROW_ID('HX2Q','36')

from hx2q_project

where objectid not in (select distinct objidfrom hx2q_risk_result_temp)

and ptcode = 'm01' and flag = 0 and status = '开工'

说明:

1、difference计算中,where后的条件是必须的;

2、union计算是通过后台程序实现的。

以上就是sde用sql实现erase_MySQL的内容,更多相关内容请关注PHP中文网(www.gxlcms.com)!

本条技术文章来源于互联网,如果无意侵犯您的权益请点击此处反馈版权投诉

本文系统来源:php中文网

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值