最好的学习资料ArcGIS api fo silverlight官网:http://help.arcgis.com/en/webapi/silverlight/samples/start.htm

一、GeoServer环境搭建及数据发布

参考:http://www.cnblogs.com/beniao/archive/2011/01/08/1930822.html等

二、创建ArcGIS API for SilverLight应用

参考:http://blog.csdn.net/zdw_wym/article/details/7620962

1、创建SilverLight应用程序

2、添加ArcGIS API for SilverLight相关引用

3、往MainPage.xaml中添加地图控件代码

四、读取GeoServer后台发布的图层

参考出处:http://blog.csdn.net/xinruogis/article/details/5567103

1、创建类文件,实现自定义wms

public class WMSMapServiceLayer : DynamicMapServiceLayer  //继承接口,实现GetUrl方法
    {
        List<string> _layers = new List<string>();
        public WMSMapServiceLayer(Envelope extent, int KWID, string url, string[] layers)
        {
            this.FullExtent = extent;    //地图范围
            this.SpatialReference = new ESRI.ArcGIS.Client.Geometry.SpatialReference(KWID);  //空间参考
            this.Url = url;     //wms地址

this.Version = "1.1.1";   //wms版本
            this.Layers = layers;    //请求的图层
           // _layers.Add("topp:states");

}

public string Url { get; set; }
        public string Version { get; set; }
        //public Envelope Extent { get; set; }
        public string[] Layers
        {
            get { return _layers.ToArray(); }
            set { _layers = new List<string>(value); OnLayerChanged(); }
        }
        //public override void Initialize()
        //{
        //   // this.FullExtent = Extent;     //设置范围(不设置就无法实现)
        //    //this.SpatialReference = new SpatialReference(KWID);
        //    base.Initialize();
         
        //}

//重写获取数据接口的方法

public override void GetUrl(ESRI.ArcGIS.Client.Geometry.Envelope extent, int width, int height, DynamicMapServiceLayer.OnUrlComplete onComplete)
        {
            int extentWKID = extent.SpatialReference.WKID;
            StringBuilder mapURL = new StringBuilder();
            mapURL.Append(Url);
            mapURL.Append("?service=WMS");
            mapURL.Append("&request=GetMap");
            mapURL.AppendFormat("&width={0}", width);
            mapURL.AppendFormat("&height={0}", height);
            mapURL.AppendFormat("&format={0}", "image/png");
            mapURL.AppendFormat("&layers={0}", String.Join(",", Layers));
            mapURL.Append("&styles=");
            mapURL.AppendFormat("&bgcolor={0}", "0xFFFFFF");
            mapURL.AppendFormat("&transparent={0}", "true");
            mapURL.AppendFormat("&version={0}", Version);
            switch (Version)
            {
                case ("1.1.1"): mapURL.AppendFormat("&SRS=EPSG:{0}", extentWKID);
                    mapURL.AppendFormat(CultureInfo.InvariantCulture, "&bbox={0},{1},{2},{3}",
                        extent.XMin, extent.YMin, extent.XMax, extent.YMax); break;
            }
            //把那些字符串拼接起来,跟openlayer一样的
            onComplete(mapURL.ToString(), width, height, new ESRI.ArcGIS.Client.Geometry.Envelope()
            {
                XMin = extent.XMin,
                YMin = extent.YMin,
                XMax = extent.XMax,
                YMax = extent.YMax
            });
        }
    }

2、调用代码(MainPage.xaml.cs)

int KWID = 4326;
             Envelope extent = new Envelope(105.487843, 31.706997, 111.239656, 39.58577);
            extent.SpatialReference = new SpatialReference(KWID);
            string Url = "http://localhost:8080/geoserver/wms";

string[] layers = new string[] { "shanxi:piovrnce_region", "shanxi:city_region", "shanxi:county_region", "shanxi:capital_point", "shanxi:city_point", "shanxi:county_point" };
            WMSMapServiceLayer wms = new WMSMapServiceLayer(extent, KWID, Url,layers);
            this.myMap.Layers.Add(wms);

ArcGIS api fo silverlight学习一(silverlight加载GeoServer发布的WMS地图)的更多相关文章

  1. World Wind Java开发之十三——加载Geoserver发布的WMS服务(转)

    这篇是转载的平常心博客,原地址见:http://www.v5cn.cn/?p=171 1.WMSTiledImageLayer类说明 一个WMSTiledImageLayer类对象只能对应一个WMS发 ...

  2. JavaWeb和WebGIS学习笔记(三)——GeoServer 发布shp数据地图

    系列链接: Java web与web gis学习笔记(一)--Tomcat环境搭建 Java web与web gis学习笔记(二)--百度地图API调用 JavaWeb和WebGIS学习笔记(三)-- ...

  3. 如何在Skyline中加载ArcGISServer发布的WMS和WMTS服务

    如何在Skyline中加载ArcGISServer发布的WMS和WMTS服务? 我这里的测试环境是ArcGISServer10.1和TerraExplorer Pro7.0,主要过程截图如下,

  4. openlayer3 加载geoserver发布的WFS服务

    转自原文 openlayer3加载geoserver发布的WFS服务 openlayers3调用GeoServer发布的wfs 1 参考一 1.1 问题 openlayer3加载WFS存在跨域问题,需 ...

  5. ArcGIS API for JavaScript 4.4 版本加载谷歌地图

    ArcGIS API for JavaScript 4.X 版本升级后,API发生了很大的变化. 其中就支持了WebEarth展示,主要是通过 esri/views/SceneView 实现的. 在新 ...

  6. openlayers 3加载GeoServer发布的wfs类型服务

    转:https://blog.csdn.net/u013323965/article/details/52449502 问题产生:      openlayer3加载WFS存在跨域问题,需要用json ...

  7. arcgis api for javascript 学习(一) 调用在线发布的动态地图

    1.图中显示为arcgis软件中显示的地图文件 2.调用动态地图主要的是知道动态地图的URL地址 3.通过IDE(webstorm)调用动态地图,如图 4.话不多说,直接上代码 <!DOCTYP ...

  8. OSGEarth加载 geoserver 发布 TMS

    geoserver配好数据并用自带的gwc切片好后, 访问 http://localhost:9999/geoserver/gwc/service/tms/1.0.0/ 在OsgEarth的earth ...

  9. ArcGIS api fo silverlight学习二(silverlight加载GraphicsLayer)

    上一节学习了silverlight加载GeoServer发布的WMS地图,这一节学习一下加载GraphicsLayer 一.加载.png或jpg文件图标 1.在MainPage.xaml中添加资源配置 ...

随机推荐

  1. nsq

    官网:http://nsq.io (1)描述 都是message broker,rabbitmq久经考验,nsq则是后起之秀.rabbitmq是erlang编写,nsq是golang. 安装:http ...

  2. .NET微信开发通过Access Token和OpenID获取用户信息

    本文介绍如何获得微信公众平台关注用户的基本信息,包括昵称.头像.性别.国家.省份.城市.语言. 本文的方法将囊括订阅号和服务号以及自定义菜单各种场景,无论是否有高级接口权限,都有办法来获得用户基本信息 ...

  3. 报错:org.hibernate.AssertionFailure: null id in com.tt.hibernate.entities.News entry (don't flush the Session after an exception occurs)

    在使用hibernate创建数据库的表格时,出现了如下报错: 十二月 28, 2016 10:17:02 上午 org.hibernate.tool.hbm2ddl.SchemaExport perf ...

  4. JS 继承总结

    ES里面没有真正的继承,但是能通过某些手段达到继承效果,从而让一个类拥有另外一个类的方法  类 =>构造函数 继承描述某语言环境---魔兽世界 哈!其实我没玩过  魔兽世界里面 有Humen类  ...

  5. CentOS下Apache配置多域名或者多端口映射

    CentOS下Apache默认网站根目录为/var/www/html,假如我默认存了一个CI项目在html文件夹里,同时服务器的外网IP为ExampleIp,因为使用的是MVC框架,Apache需开启 ...

  6. Tab切换

    代码 <!DOCTYPE html> <html lang="en"><head> <meta charset="UTF-8&q ...

  7. Combobox

    1.方式一 <select id="cc" class="easyui-combobox" name="dept" style=&qu ...

  8. Esfog_UnityShader教程_溶解效果Dissolve

    溶解效果在游戏中是很常见的,比如在一些神话或者魔法世界中,一些NPC角色在剧情需要时候会身体会渐渐的消失掉.甚至有一些更炫的,比如用火焰喷射器把目标燃尽.这些都可以用到溶解效果.这篇文章主要是讲解一下 ...

  9. Java的常用对象①②

    Java的常用对象① Java的常用对象有很多,这里只对lang包中常用的Object,Date(Calendar,DateFormat,Math),System,Runtime进行介绍.㈠Objec ...

  10. sqlmap用户手册

    http://192.168.136.131/sqlmap/mysql/get_int.php?id=1 当给sqlmap这么一个url的时候,它会: 1.判断可注入的参数2.判断可以用那种SQL注入 ...