编程实现Google-Earth和ArcGIS的联动

上传人:cn****1 文档编号:488574453 上传时间:2022-12-19 格式:DOC 页数:10 大小:332.50KB
返回 下载 相关 举报
编程实现Google-Earth和ArcGIS的联动_第1页
第1页 / 共10页
编程实现Google-Earth和ArcGIS的联动_第2页
第2页 / 共10页
编程实现Google-Earth和ArcGIS的联动_第3页
第3页 / 共10页
编程实现Google-Earth和ArcGIS的联动_第4页
第4页 / 共10页
编程实现Google-Earth和ArcGIS的联动_第5页
第5页 / 共10页
点击查看更多>>
资源描述

《编程实现Google-Earth和ArcGIS的联动》由会员分享,可在线阅读,更多相关《编程实现Google-Earth和ArcGIS的联动(10页珍藏版)》请在金锄头文库上搜索。

1、编程实现Google Earth和ArcGIS的联动demo 这个DEMO实现的功能就是在google earth中用鼠标获取地理坐标,然后自动定位到ARCGIS对应的区域影像中。前段时间因项目引导,在师兄的启发下,做了一个这样的Demo,后来因为各种原因一直没有进行下去。现在感觉还是有些用处的,现在抽空整理一下。 Google Earth是一款优秀的Map Explorer,它的优秀在于使用普及和方便,虽然DigitalGlobe影像数据更新速度慢,但分辨率是还是很高的,最高可达到0.5m。如果忽略其误差,可以利用Google Earth的影像资源进行定位参考、解译参考、数字化等。 Goog

2、le Earth继Google Map API之后推出的Google Earth COM API ,提供的功能相对比较弱,一些功能据说似乎还存在着Bug。网址:http:/ earth的二次开发有两种方法:(1)使用windows API控制两个进程的调用,利用google earth api实现核心功能。(2)使用做好的务功能重点放在GE API开发上。这个demo使用的是GEVContorl(GEVC),它是一个完全COM的控件,对截止目前所有版本的GoogleEarth都支持,具有很高的兼容性和可用性,能够将GE视图(地球视图)集成到开发人员的应用系统中,并且支持滚轮功能。下载地址:ht

3、tp:/ Earth 1.0 Type Library到库应用.二、.NET中新建Arcgis command类。将生成一个dll,可以被ARCGIS自动添加到组件库中。三、部分代码,主窗口中:推荐精选1ImportsEARTHLib2ImportsESRI.ArcGIS.Controls3ImportsESRI.ArcGIS.Geometry4ImportsESRI.ArcGIS.Carto5ImportsESRI.ArcGIS.SystemUI6ImportsESRI.ArcGIS.ArcMapUI7ImportsESRI.ArcGIS.esriSystem8ImportsESRI.Arc

4、GIS.Framework9ImportsESRI.ArcGIS.Geodatabase10ImportsESRI.ArcGIS.Display11ImportsSystem.Windows.Forms.Cursor12ImportsSystem.Drawing13ImportsSystem.Drawing.Drawing2D141516PublicClassForm217Publicg_GeHelperAsEARTHLib.ApplicationGEGE的主应用API18PublichookhelperAsIHookHelperhookhelper19PubliclongitudeAsDou

5、ble经度20PubliclatitudeAsDouble维度21DimpAppAsIApplication22DimpEnableAsBoolean23DimpDocAsIMxDocument24DimpWorkspaceAsIWorkspace推荐精选25DimpMapAsIMap26DimpLayerAsILayer27DimpWorkEAsIWorkspaceEdit28DimpFeaLayerAsIFeatureLayer29PrivateStructurePOINTAPI30DimxAsDouble31DimyAsDouble32EndStructure3334PrivateSub

6、Button1_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton1.Click35初始化应用GE36g_GeHelper=NewEARTHLib.ApplicationGE37AxGEViewer1.HookGE(g_GeHelper.GetMainHwnd,g_GeHelper.GetRenderHwnd)38EndSub394041PrivateSubAxGEViewer1_MouseDownEvent(ByValsenderAsSystem.Object,ByValeAsAxGEVControl

7、._GEViewer_MouseDownEvent)HandlesAxGEViewer1.MouseDownEvent42IfCheckBox1.Checked=TrueThen43DimGePtAsPointOnTerrainGE44DimptAsPOINTAPI45屏幕坐标到GE屏幕坐标的转换46pt.x=e.evtArgs.X*2/Me.Width-147pt.y=-e.evtArgs.Y*2/Me.Height+1推荐精选48GE屏幕坐标到地理坐标的转换49GePt=g_GeHelper.GetPointOnTerrainFromScreenCoords(CDbl(pt.X),CDbl

8、(pt.Y)5051MsgBox(点击屏幕坐标:&pt.x&,&pt.y&获得ge坐标:&GePt.Longitude&,&GePt.Latitude)52longitude=GePt.Longitude53latitude=GePt.Latitude54pMap=hookhelper.ActiveView5556arcmap中绘制点57DimpointAsIPoint58point=NewESRI.ArcGIS.Geometry.Point59point.PutCoords(longitude,latitude)6061DimpMarkerElementAsIMarkerElement62p

9、MarkerElement=NewMarkerElement6364DimpMarkerSymbolAsESRI.ArcGIS.Display.ISimpleMarkerSymbol65pMarkerSymbol=NewESRI.ArcGIS.Display.SimpleMarkerSymbol66pMarkerSymbol.Size=367pMarkerSymbol.Style=ESRI.ArcGIS.Display.esriSimpleMarkerStyle.esriSMSDiamond68推荐精选69DimpElementAsIElement70pElement=pMarkerEleme

10、nt71pElement.Geometry=point72pMarkerElement.Symbol=pMarkerSymbol7374DimpGraphicsContainerAsIGraphicsContainer75DimpActiveViewAsIActiveView76pActiveView=pMap77pActiveView.Extent.CenterAt(point)7879arcmap中点的定位80DimpEnvelopAsIEnvelope81pEnvelop=pActiveView.Extent82pEnvelop.CenterAt(point)83pActiveView.

11、Extent=pEnvelop84pActiveView.Refresh()85pGraphicsContainer=pMap86pGraphicsContainer.AddElement(pMarkerElement,0)87pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics,Nothing,Nothing)88EndIf8990EndSub91PublicWriteOnlyPropertyhook()AsIHookHelper92Set(ByValvalueAsIHookHelper)93hookhelper=value94EndSet95EndProperty96推荐精选97PrivateSubForm2_Load(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesMyBase.Load9899EndSub100EndClasscommand.cs中实现组件注册:63Privatem_hookHelperAsIHookHelper646566AcreatableCOMclassmusthaveaPublicSubNew()67withnoparameters,otherwise,theclass

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 资格认证/考试 > 自考

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号