ArcEngine在地图上加载Server图层数据
例:加载服务地址"http://services.arcgisonline.com/ArcGIS/services"中的"ESRI_Imagery_World_2D"数据对象(图层)到地图上。
private void GetServerTest() { //获得服务对象名称 IAGSServerObjectName serverObjectName =GetMapServer( "http://services.arcgisonline.com/ArcGIS/services", "ESRI_Imagery_World_2D", false); IName pName = (IName)serverObjectName; //访问地图服务 IAGSServerObject serverObject = (IAGSServerObject)pName.Open(); IMapServer mapServer = (IMapServer)serverObject; IMapServerLayer mapServerLayer = new MapServerLayer() as IMapServerLayer; //连接地图服务 mapServerLayer.ServerConnect(serverObjectName, mapServer.DefaultMapName); //添加数据图层 _application.MapControl.AddLayer(mapServerLayer as ILayer); _application.MapControl.Refresh(); } public IAGSServerObjectName GetMapServer(string pHostOrUrl, string pServiceName, bool pIsLAN) { //设置连接属性 IPropertySet propertySet = new PropertySetClass(); if (pIsLAN) propertySet.SetProperty("machine", pHostOrUrl); else propertySet.SetProperty("url", pHostOrUrl); //打开连接 IAGSServerConnectionFactory factory = new AGSServerConnectionFactory(); IAGSServerConnection pConnection = factory.Open(propertySet, 0); //Get the image server. IAGSEnumServerObjectName pServerObjectNames = pConnection.ServerObjectNames; pServerObjectNames.Reset(); IAGSServerObjectName ServerObjectName = pServerObjectNames.Next(); while (ServerObjectName != null) { if ((ServerObjectName.Name.ToLower() == pServiceName.ToLower()) && (ServerObjectName.Type == "MapServer") ) { break; } ServerObjectName = pServerObjectNames.Next(); } return ServerObjectName; }
专业从事基于C#,WinForm ,WPF,Silverlight,WCF以及MS Sql Server 2000/2005/2008/2012 Oracle 9i/10g/11g数据库系统的ERP,CRM,企业进销存等各种数据库管理系统开发。Asp.net,Asp.net mvc,Webservice,WCF, Webapi等服务程序开发。
基于Oracle MySQL MSSql postgresql各种数据库的管理系统数据同步服务。以及基于MapXtreme, Arcgis Engine ,以及基于Arcgis for silverlight/Javascript的WebGIS等相关的GIS系统二次开发。基于Windows 10 Mobile的移动端开发方案。针对各种系统的二次开发维护,并提供相关开发的技术性支持,如程序BUG解决,应用系统架构,技术难题攻克等相关技术服务。
联系方式: QQ :80163278(devgis) 邮箱:devgis@qq.com