您的位置:首页 > 其它

ArcGIS API for Silverlight开发入门 (1)

2012-04-18 21:32 513 查看
上篇已经简单介绍了ArcGis API for Silverlight开发环境的搭建,此篇闲话少叙,直接来看一个简单的例子。

一、工程目录截图:





二、创建步骤

分如下 几个步骤:

1、新建Silverlight工程 Silverlight4ArcGisExample1。

2、添加ESRI.ArcGIS.Client.dll引用。

3、在MainPage下创建如下代码。

<UserControl x:Class="Silverlight4ArcGisExample1.MainPage"

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 x:Name="mymap">

<esri:Map.Layers>

<esri:ArcGISTiledMapServiceLayer ID="layerworldmap" Url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer" />

</esri:Map.Layers>

</esri:Map>

</Grid>

</UserControl>



三、运行结果:





四、知识点说明

1、Map标签(继承自xaml的Control)相当于一个Map控件,可以在其中加入图层;这里我们添加了一个ArcGISTiledMapServiceLayer图层,还有其它图层我们会在后续说明。

2、图层中的URL属性为已经发布的地图服务,例子中为Esir公司的在线服务。

该地址可在浏览器中直接访问,访问后点击ArcGIS JavaScript可进行预览。



内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐