当前位置:编程学习 > 网站相关 >>

arcgisserver中发布的地图在silverlight应用程序中无法显示

在catalog、server manager中都可以预览的地图,vs中建立silverlight应用程序无法显示:
xaml页面代码:
<UserControl x:Class="_10_1.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:esri="http://schemas.esri.com/arcgis/client/2009"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">

    <Grid x:Name="LayoutRoot" Background="White">
        <esri:Map x:Name="myMap" ZoomDuration="00:00:00" PanDuration="00:00:00" SnapToLevels="False" WrapAround="True">
            <esri:ArcGISTiledMapServiceLayer ID="streetMapLayer" 
                                             Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"
                                             InitializationFailed="Layer_InitializationFailed"
                                             />
            <esri:ArcGISDynamicMapServiceLayer ID="myPublishedMapLayer"
                                               Url="http://localhost/arcgis/rest/services/worldsocsituation/MapServer"
                                               InitializationFailed="ArcGISDynamicMapServiceLayer_InitializationFailed"
                                               />
        </esri:Map>
    </Grid>
</UserControl>

cs代码:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using ESRI.ArcGIS.Client;

namespace _10_1
{
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
        }

        private void Layer_InitializationFailed(object sender, EventArgs e)
        {
            Layer lyr = sender as Layer;
            MessageBox.Show("加载地图失败:"+lyr.InitializationFailure.Message);
        }

        private void ArcGISDynamicMapServiceLayer_InitializationFailed(object sender, EventArgs e)
        {
            Layer lyr2 = sender as Layer;
            MessageBox.Show("加载地图失败:" + lyr2.InitializationFailure.Message);

        }
        
    }
}
Silverlight 地图 Esri --------------------编程问答-------------------- The spatial reference is defined by the first layer with a spatial reference in the layer collection. Layers in the map must support the spatial reference defined by the map. If the spatial reference does not match, the layer (that is, service) must be capable of reprojecting its content to be displayed correctly in the map. 
这是帮助中的原话,其他没看出什么,你看看坐标系这块 --------------------编程问答-------------------- esri 的底图可以显示吗?
补充:企业软件 ,  地理信息系统
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,