免费视频|新人指南|投诉删帖|广告合作|地信网APP下载

查看: 2226|回复: 6
收起左侧

技术资料:确定两区域间叠加部分面积大小:

[复制链接]

2072

主题

100000万

铜板

363

好友

地信专家组

每一次的分离都是为了下一次的相聚

Rank: 14Rank: 14Rank: 14Rank: 14

积分
17612

精华勋章宣传勋章爱心勋章组织勋章地信元老灌水勋章荣誉会员勋章活跃勋章贡献勋章

发表于 2009-11-15 19:27 | 显示全部楼层 |阅读模式
技术资料:确定两区域间叠加部分面积大小:
以下代码首先创建两区域,通过IntersectFeatures方法确定叠加区域,再比较叠加区域与某一区域面积比

Private Sub Command1_Click()
Dim pts As New Points
Dim pts2 As New Points
Dim reg As New Feature
Dim reg2 As New Feature
Dim overlap As Feature
'Create a Temp layer
Map1.Layers.CreateLayer ("Temp")
'Setting the Coordinates for reg (the first region)
pts.AddXY -78.695, 45.46
pts.AddXY -74.177, 45.172
pts.AddXY -74.432, 42.55
pts.AddXY -78.003, 42.523
'Setting the Coordinates for reg2 (the second region)
pts2.AddXY -76.509, 44.071
pts2.AddXY -71.261, 43.939
pts2.AddXY -71.371, 42.261
pts2.AddXY -76.254, 42.655
'Creating reg
Set reg = Map1.FeatureFactory.CreateRegion(pts, Map1.DefaultStyle)
'Adding reg to the Map
Set reg = Map1.Layers("Temp").AddFeature(reg)
'Creating reg2
Set reg2 = Map1.FeatureFactory.CreateRegion(pts2, Map1.DefaultStyle)
'Adding reg2 to the Map
Set reg2 = Map1.Layers("Temp").AddFeature(reg2)
'Creating overlap, where the two regions overlap
Set overlap = Map1.FeatureFactory.IntersectFeatures(reg, reg2)
'Changing the region style of overlap
overlap.Style.RegionColor = miColorYellow
'Adding overlap to the Map
Set overlap = Map1.Layers.Item("Temp").AddFeature(overlap)
MsgBox reg.Area 'Area for first region
MsgBox reg2.Area 'Area for second region
MsgBox overlap.Area 'Area for overlap region
' Percentage of overlap area compared to the second region
MsgBox (overlap.Area / reg2.Area) * 100
End Sub

2

主题

3万

铜板

7

好友

钻石会员

Rank: 26Rank: 26Rank: 26Rank: 26Rank: 26Rank: 26Rank: 26

积分
5704
发表于 2021-12-19 14:53 | 显示全部楼层
谢谢分享
回复

使用道具 举报

0

主题

2万

铜板

1

好友

资深会员

Rank: 18Rank: 18Rank: 18Rank: 18Rank: 18

积分
3419
发表于 2022-1-4 12:55 | 显示全部楼层
确定两区域间叠加部分面积
回复 支持 反对

使用道具 举报

2

主题

1万

铜板

7

好友

钻石会员

Rank: 26Rank: 26Rank: 26Rank: 26Rank: 26Rank: 26Rank: 26

积分
6419
发表于 2022-11-12 15:30 | 显示全部楼层
灰常感谢
回复

使用道具 举报

2

主题

1万

铜板

7

好友

钻石会员

Rank: 26Rank: 26Rank: 26Rank: 26Rank: 26Rank: 26Rank: 26

积分
6419
发表于 2023-1-4 17:17 | 显示全部楼层
没事来逛逛
回复 支持 反对

使用道具 举报

0

主题

1108

铜板

2

好友

助理工程师

Rank: 5Rank: 5

积分
166
发表于 2023-1-13 17:24 | 显示全部楼层
谢谢分享
回复

使用道具 举报

0

主题

952

铜板

1

好友

技术员

Rank: 3Rank: 3

积分
61
QQ
发表于 2023-5-26 10:50 | 显示全部楼层
感谢分享
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

在线客服
快速回复 返回顶部 返回列表