阅读:1838回复:5
[求助]请问union
<P>请问要将两各shape文件合并成一各</P>
<P>是不是要使用到union的指令</P> <P>如果是要如何使用啊</P> <P>如果不是又该如何做了</P> <P>请各位大大赐教</P> |
|
1楼#
发布于:2005-07-22 09:15
直接用这个方法就能把两个shape合并成一个了
|
|
|
2楼#
发布于:2005-07-22 23:39
<P>不好意思啊大大</P>
<P>我是新手所以不是很了解</P> <P>不知道大大可以提供一段程序码吗</P> <P>这样我比较好了解</P> <P>大大只说这样对我来说有点不了解</P> <P>另外就是</P> <P>那连数据资料也会一并合并还是说不会</P> <P>请大大指导一下</P> [此贴子已经被作者于2005-7-22 23:42:03编辑过]
|
|
3楼#
发布于:2005-07-27 13:32
<P>小弟后来看了一些文献</P>
<P>发现union的指令适用于polygon,line等等</P> <P>但是好像都只是两个polygon作union</P> <P>可是我所要作的union是一个省份(内包含很多polygon也就是县市)</P> <P>跟也是内涵polygon的shape,两各文件作union</P> <P>功能跟ArcMap内做overlap是差不多的功能</P> <P>不知道到底应该如何实作</P> <P>烦请版主大大解答一下</P> <P>如果有参考文件,方便的话可以提供吗</P> |
|
4楼#
发布于:2005-12-27 11:56
<P>Option Explicit</P>
<P>定义两个对象<BR>Dim shape1 As Object<BR>Dim shape2 As Object<BR>Dim union As Boolean</P> <P>Private Sub doUnion(shape As Object)<BR> If Not union Then<BR> Set shape1 = shape<BR> union = True<BR> <BR> ElseIf union Then<BR> Set shape2 = shape<BR> Dim unionShape As MapObjects2.Polygon<BR> Dim unionEvent As New MapObjects2.GeoEvent<BR> <BR> Set unionShape = shape1.union(shape2, Map1.FullExtent)<BR> Set unionEvent = Map1.TrackingLayer.AddEvent(unionShape, 1)<BR> <BR> Set shape1 = Nothing</P> <P> union = False<BR> End If<BR>End Sub</P> <P>Private Sub Map1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)<BR> <BR> If Button = 2 Then<BR> Dim r As New MapObjects2.Rectangle<BR> Set r = Map1.TrackRectangle<BR> Map1.Extent = r<BR> Exit Sub<BR> End If<BR> <BR> 'Rectangle union<BR> If Option1.Value Then<BR> Dim rect As New MapObjects2.Rectangle<BR> Dim eventRect As New MapObjects2.GeoEvent<BR> Set rect = Map1.TrackRectangle<BR> Set eventRect = Map1.TrackingLayer.AddEvent(rect, 0)</P> <P> Call doUnion(rect)<BR> <BR> 'Ellipse union<BR> ElseIf Option2.Value Then<BR> Dim elli As New MapObjects2.Ellipse<BR> Dim theExt As New MapObjects2.Rectangle<BR> Dim eventElli As New MapObjects2.GeoEvent<BR> <BR> Set theExt = Map1.TrackRectangle<BR> elli.Bottom = theExt.Bottom<BR> elli.Top = theExt.Top<BR> elli.Left = theExt.Left<BR> elli.Right = theExt.Right<BR> <BR> Set eventElli = Map1.TrackingLayer.AddEvent(elli, 0)<BR> Call doUnion(elli)<BR> <BR> 'Polygon union</P> <P> ElseIf Option3.Value Then<BR> Dim poly As New MapObjects2.Polygon<BR> Dim eventPoly As New MapObjects2.GeoEvent<BR> Set poly = Map1.TrackPolygon<BR> Set eventPoly = Map1.TrackingLayer.AddEvent(poly, 0)<BR> Call doUnion(poly)<BR> End If<BR>End Sub</P> <P>Private Sub Form_Load()<BR> Option1.Caption = "Rectangle"<BR> Option2.Caption = "Ellipse"<BR> Option3.Caption = "Polygon"<BR> <BR> Map1.TrackingLayer.SymbolCount = 2<BR> With Map1.TrackingLayer.Symbol(0)<BR> .SymbolType = moFillSymbol</P> <P> .Style = moGrayFill<BR> .Color = moRed<BR> .OutlineColor = moRed<BR> End With<BR> With Map1.TrackingLayer.Symbol(1)<BR> .SymbolType = moFillSymbol<BR> .Style = moGrayFill<BR> .Color = moBlue<BR> .OutlineColor = moBlue<BR> End With<BR>End Sub<IMG src="http://www.gisempire.com/bbs/Skins/Default/emot/em03.gif"></P> <P>书上的</P> |
|
5楼#
发布于:2005-12-27 11:57
如果是多个,就用记录集里提取出来一个一个的相符union
|
|