Select to view content in your preferred language

Magnifier tool and Dynamic layers

2494
4
12-20-2010 12:11 AM
MatthewPilgrim
Regular Contributor
EDIT: This works when pointing at all layers but not one layer i.e. Mapserver/0
Hi,

I'm sure I read somewhere that the ESRI Magnifier tool works with multiple layers and dynamic layers. However I can't seem to get dynamic layers to display. Here is a very simple example based on the sample server.

XAML:
<UserControl x:Class="MapApp.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="http://schemas.esri.com/arcgis/client/2009" 
    xmlns:esriSymbols="clr-namespace:ESRI.ArcGIS.Client.Symbols;assembly=ESRI.ArcGIS.Client"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">

    <Grid x:Name="LayoutRoot" Background="White">
        <esri:Map x:Name="MyMap" MouseLeftButtonDown="MyMap_MouseLeftButtonDown">
            <esri:Map.Layers>
                <esri:ArcGISDynamicMapServiceLayer ID="StreetMapLayer" Url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer" /> 
            </esri:Map.Layers>
        </esri:Map>
        <Canvas>
            <esri:Magnifier x:Name="MyMagnifier" ZoomFactor="2" Map="{Binding ElementName=MyMap}" Canvas.ZIndex="10">
                <esri:Magnifier.Layers>
                    <esri:ArcGISDynamicMapServiceLayer ID="MagnifyImageLayer"
                        Url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer/0" />
                </esri:Magnifier.Layers>
            </esri:Magnifier>
        </Canvas>
    </Grid>
</UserControl>


Code behind:
using System;
using System.Net;
using System.Windows.Controls;
using System.Windows.Input;

namespace MapApp
{
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
        }
        private void MyMap_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            MyMagnifier.Enabled = !MyMagnifier.Enabled;
        }
    }
}


And the error message:
Line: 56 
Error: Unhandled Error in Silverlight Application  
Code: 4004  
Category: ManagedRuntimeError  
Message: System.ArgumentException: Service URL does not contain any layer. 
at ESRI.ArcGIS.Client.Layer.OnInitializationFailed(EventArgs e) 
at ESRI.ArcGIS.Client.Layer.Initialize() 
at ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer.<>n__FabricatedMethod8() 
at ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer.<>c__DisplayClass6.<MapServiceInfoInitFailed>b__4()  


Note I've tried pointing the magnifier at "MapServer" which works but "MapServer/0" doesn't.

Should pointing at one layer work?

Secondly, with our own map server I can load the dynamic layers with a zoom level of 1.5 but when this is increased to say 2.0 they stop appearing. Is there something server side that limits the zoom factor?
Thanks, Matt
0 Kudos
4 Replies
DominiqueBroux
Esri Frequent Contributor

This works when pointing at all layers but not one layer i.e. Mapserver/0

If you are pointing one layer, you have to use a FeatureLayer instead of an ArcGISDynamicMapServiceLayer.

Is there something server side that limits the zoom factor?

Might be a minimum resolution set on the layer.
0 Kudos
MatthewPilgrim
Regular Contributor
Thanks,

I've just tried:

<esri:ArcGISDynamicMapServiceLayer ID="MagnifyImageLayer"
                        Url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer/0" />
<esri:ArcGISDynamicMapServiceLayer ID="MagnifyImageLayer"
                        Url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer/1" />


And get the same error message.  Can you elaborate on what should/shouldn't work please?

I'll check the resolution issue.

Thanks again, Matt
0 Kudos
DominiqueBroux
Esri Frequent Contributor

<esri:ArcGISDynamicMapServiceLayer ID="MagnifyImageLayer" Url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer/0" />



http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StatesCitiesRivers_USA/Map... is the URL of a FeatureLayer not a map service layer.

So, should work:
<esri:FeatureLayerID="MagnifyImageLayer" Url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StatesCitiesRivers_USA/Map.../0" />

or

<esri:ArcGISDynamicMapServiceLayer ID="MagnifyImageLayer" Url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StatesCitiesRivers_USA/Map..." VisibleLayers="0" />
0 Kudos
MatthewPilgrim
Regular Contributor
Thanks,

My mistake!  Your second example gave me the clue I needed.

Matt
0 Kudos