导航

Arcgis silverlight-1 地图显示

Posted on 2010-06-02 10:41  寒宵飞飞  阅读(858)  评论(3编辑  收藏  举报
 1、功能:地图显示

建立一个silverlight程序

MainPage.xmal中的代码:

 

代码
<UserControl x:Class="SilverlightApplication1.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"
    mc:Ignorable=
"d"
    d:DesignHeight=
"300" d:DesignWidth="400" xmlns:esri="http://schemas.esri.com/arcgis/client/2009">

    <
Grid x:Name="LayoutRoot" Background="White">
        
        <
esri:Map x:Name="MyMap" >
            <
esri:ArcGISDynamicMapServiceLayer ID="ditu_quhua" Opacity="0.6" 
                    Url
="http://192.168.1.14:8081/scyc/rest/services/ditu_quhua(WGS_1984)/MapServer" />
        </
esri:Map>

    </
Grid>
</
UserControl>

 

 

2、代码详解:

//以下4行添加一个XML命名空间,用来调用ArcGIS schema for Silverlight/WPF,使用ESRI.ArcGIS.Client, ESRI.ArcGIS.Client.Behaviors, and ESRI.ArcGIS.Client.Toolkit assemblies

<UserControl x:Class="SilverlightApp.Page"   

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"    

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"    

xmlns:esri="http://schemas.esri.com/arcgis/client/2009">  

 

<Grid x:Name="LayoutRoot" Background="White">//添加一个容器grid,保存地图控件mapcontrol

 

<esri:Map x:Name="MyMap" >//地图名称

  <esri:ArcGISDynamicMapServiceLayer ID="ditu_quhua" Opacity="0.6" 
                    Url
="http://192.168.1.14:8081/scyc/rest/services/ditu_quhua(WGS_1984)/MapServer" />
//设置地图服务网址Url,地图图层ID,图层透明度Opacity

        

</esri:Map>

</Grid>

</UserControl>

 

3、功能展示