ArcGIS API for Silverlight 入门学习笔记(一):hello world

本人也是刚刚开始学习silverlight和arcgis server,所以很多问题还不太懂,希望通过博文来和大家交流

 现在开始ArcGIS API for Silverlight的hello world 之旅

新建一个Silverlight项目,在MainPage.xaml文件中,引入 ESRI.ArcGIS.Client 命名空间和 ESRI.ArcGIS.Client 所在的程序集 ESRI.ArcGIS.Client,并指定该命名空间的名字为ESRI(这个名字是自定义的,也可以是阿毛阿狗)

注:引入方法,在silverlight项目上(不是Web)点击右键——添加引用——浏览——ESRI.ArcGIS.Client.dll——确定

ESRI.ArcGIS.Client.dll的路径X:\Program Files\ESRI SDKs\Silverlight\v1.2


接着写Map控件,并指定Map中的地图服务,一个简单的服务地图完成了,代码如下:

代码
<UserControl x:Class="APIforSilverlightSamp.s1"
xmlns
="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x
="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d
="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc
="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ESRI
="clr-namespace:ESRI.ArcGIS.Client;assembly=ESRI.ArcGIS.Client"
mc:Ignorable
="d"
d:DesignHeight
="300" d:DesignWidth="400">

<Grid x:Name="LayoutRoot" Background="White">
<ESRI:Map>
<ESRI:ArcGISTiledMapServiceLayer
Url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer" >
</ESRI:ArcGISTiledMapServiceLayer>
</ESRI:Map>
</Grid>
</UserControl>

按F5运行后,可以看到一幅漂亮的地图,预览效果如下:

当然我们也可以添加其他类型的地图服务,比如说ArcGISDynamicMapServiceLayer 类型,我们也可以在一个地图控件上加载多个地图服务。

代码
<UserControl x:Class="APIforSilverlightSamp.s1"
xmlns
="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x
="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d
="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc
="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ESRI
="clr-namespace:ESRI.ArcGIS.Client;assembly=ESRI.ArcGIS.Client"
mc:Ignorable
="d"
d:DesignHeight
="300" d:DesignWidth="400">

<Grid x:Name="LayoutRoot" Background="White">
<ESRI:Map>
<ESRI:ArcGISTiledMapServiceLayer
Url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer" >
</ESRI:ArcGISTiledMapServiceLayer>
<ESRI:ArcGISDynamicMapServiceLayer
Url="http://serverapps.esri.com/ArcGIS/rest/services/California/MapServer">
</ESRI:ArcGISDynamicMapServiceLayer>
</ESRI:Map>
</Grid>
</UserControl>

按F5运行后,可以看到一幅漂亮的地图,预览效果如下:


这次所做的只是一个入门,引用的服务也是ESRI公司提供的,预计下一节会谈到自己发布服务

引用的地图可以在这里看到http://resources.esri.com/arcgisserver/apis/silverlight/

学习资料:http://www.cnblogs.com/gisland/archive/2010/06/22/1762607.html

http://blog.csdn.net/chenshizero/archive/2010/02/23/5318488.aspx

ESRI.ArcGIS.Client.dll下载请点我

原文地址:https://www.cnblogs.com/junyuz/p/1929020.html