Select to view content in your preferred language

I'd like magnifier to magnify visible layers

873
4
Jump to solution
04-29-2014 12:19 PM
DanielSchatt
Regular Contributor
hi all, I have code that had been working perfectly with a dynamic map service to synchronize the visible magnified layers for my magnifier with the visible layers in the map contents.  This was pretty cool because it magnified whatever layers that were visible at that moment in the map window.  I had other tiled map services in the application and, in a similar manner, it only magnified the ones visible at that moment.

But I just moved the dynamic map service from a server running ArcGIS Server 9.3.1 to a server running 10.0, and now it's not working anymore.  The tiled map services from ESRI's server are still synced properly between the table of contents and the magnifier and are magnified as they should be, using the magnifier's MouseLeftButtonDown handler.  This is also setting the dynamic map service layer's visibility to true, as it should.  But this handler isn't picking up the results from the VisibilityChanged handler, which sets the visibility of the magnified sublayers (layers within the dynamic map service) equal to their visibility in the map window.  I don't see any of these dynamic map service sublayers in the magnifier, regardless of what's visible in the map window.

I used display strings in the code to test it and everything seems to be accessed and set properly in the code blocks. But none of the dynamic map service sublayers are showing up within the magnifier.  Many thanks in advance! Here's my relevant code:


XAML:

<esri:Map x:Name="ShorelineAssessmentMapperMap" Background="White" RenderTransformOrigin="-2.037,-2.183" IsLogoVisible="False" Extent="-8621895,4355084,-8308076,4616144" ExtentChanged="ShorelineAssessmentMapperMap_ExtentChanged" >          <esri:ArcGISTiledMapServiceLayer ID="Base map" Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" Visible="True" />       <esri:ArcGISTiledMapServiceLayer ID="VGIN 2013 imagery" Url="http://gismaps.vita.virginia.gov/arcgis/rest/services/VBMP2013/VBMP2013_WGS/MapServer" Visible="False" />       <esri:ArcGISTiledMapServiceLayer ID="USGS topos" Url="http://services.arcgisonline.com/ArcGIS/rest/services/USA_Topo_Maps/MapServer" Visible="False" />       <esri:ArcGISDynamicMapServiceLayer ID="Data" Url="http://cmap.vims.edu/ArcGIS/rest/services/ShorelineAssessmentMapper/MapServer" VisibilityChanged="ArcGISDynamicMapServiceLayer_VisibilityChanged" PropertyChanged="ArcGISDynamicMapServiceLayer_PropertyChanged" />  </esri:Map>   <Grid HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0,10,10,0" >  <Image x:Name="MyMagnifyImage" Source="http://help.arcgis.com/en/webapi/silverlight/samples/Assets/images/magglass.png"  Canvas.ZIndex="10" Margin="25, 20, 20, 25"     Stretch="UniformToFill" Width="32" Height="50"        MouseLeftButtonDown="MyMagnifyImage_MouseLeftButtonDown" /> </Grid>  <Canvas>  <esri:Magnifier x:Name="MyMagnifier" ZoomFactor="3" Canvas.ZIndex="10" Map="{Binding ElementName=ShorelineAssessmentMapperMap}" Opacity="1.0" Canvas.Left="-10" Canvas.Top="50" d:IsHidden="True" >       <esri:Magnifier.Layers>       <esri:ArcGISTiledMapServiceLayer ID="Base map" Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" />                     <esri:ArcGISTiledMapServiceLayer ID="VGIN 2013 imagery" Url="http://gismaps.vita.virginia.gov/arcgis/rest/services/VBMP2013/VBMP2013_WGS/MapServer" />                     <esri:ArcGISTiledMapServiceLayer ID="USGS topos" Url="http://services.arcgisonline.com/ArcGIS/rest/services/USA_Topo_Maps/MapServer" />                     <esri:ArcGISDynamicMapServiceLayer ID="Data" Url="http://cmap.vims.edu/ArcGIS/rest/services/ShorelineAssessmentMapper/MapServer" />       </esri:Magnifier.Layers>  </esri:Magnifier> </Canvas>



Code-behind:

private void MyMagnifyImage_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) {        if (!MyMagnifier.Enabled)        {            foreach (var layer in MyMagnifier.Layers)            {                var mapLayer = ShorelineAssessmentMapperMap.Layers.Where(l => l.ID == layer.ID).FirstOrDefault();                if (mapLayer != null)                    layer.Visible = mapLayer.Visible;            }        }         MyMagnifier.Enabled = !MyMagnifier.Enabled;           }      private void ArcGISDynamicMapServiceLayer_VisibilityChanged(object sender, System.EventArgs e) {        var mainDynamicLayer = sender as ArcGISDynamicMapServiceLayer;        var magnifierDynamicLayer = mainDynamicLayer == null ? null             : MyMagnifier.Layers.OfType<ArcGISDynamicMapServiceLayer>().Where(l => l.ID == mainDynamicLayer.ID).FirstOrDefault();         if (mainDynamicLayer != null && magnifierDynamicLayer != null)            magnifierDynamicLayer.VisibleLayers = mainDynamicLayer.VisibleLayers;         magnifierDynamicLayer.Refresh(); }   private void ArcGISDynamicMapServiceLayer_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) {        if (e.PropertyName == "Visible")        {            var mainDynamicLayer = sender as ArcGISDynamicMapServiceLayer;            var magnifierDynamicLayer = mainDynamicLayer == null ? null                     : MyMagnifier.Layers.OfType<ArcGISDynamicMapServiceLayer>().Where(l => l.ID == mainDynamicLayer.ID).FirstOrDefault();             if (mainDynamicLayer != null && magnifierDynamicLayer != null)                     magnifierDynamicLayer.Visible = mainDynamicLayer.Visible;        } }
0 Kudos
1 Solution

Accepted Solutions
AhmedEl-Sisi
Deactivated User
If you have access to your map server you can increase MaxImageHeight and MaxImageWidth config values for your service.
The default is 2048 x 2048.
By changing these values you will increase image size the map service will export and this will resolve your issue.
I tested it and it works fine.
Check the following posts for more info:
http://forums.arcgis.com/threads/8726-Magnifier-Bug
http://forums.arcgis.com/threads/82705-Maximum-screen-resolution-map-not-loading-on-large-monitor

Regards,

View solution in original post

0 Kudos
4 Replies
AhmedEl-Sisi
Deactivated User
Hi Dan,

Referencing to this post your magnified map size (Resolution) is multiplied by your Zoom Factor and this may cause some errors for your layer.
I tested your code and it shows the layer if you change map size and zoom factor.

Regards,
0 Kudos
DanielSchatt
Regular Contributor
thanks Ahmed.  It does work now but it seems I can only go up to magnifIcation 1.35 (unless I try changing the map resolution).  Anyway I really appreciate your help!
0 Kudos
AhmedEl-Sisi
Deactivated User
If you have access to your map server you can increase MaxImageHeight and MaxImageWidth config values for your service.
The default is 2048 x 2048.
By changing these values you will increase image size the map service will export and this will resolve your issue.
I tested it and it works fine.
Check the following posts for more info:
http://forums.arcgis.com/threads/8726-Magnifier-Bug
http://forums.arcgis.com/threads/82705-Maximum-screen-resolution-map-not-loading-on-large-monitor

Regards,
0 Kudos
DanielSchatt
Regular Contributor
Excellent!!  Again, many thanks!
Dan
0 Kudos