Map Resolutions

3366
12
08-15-2011 10:52 PM
JamesMcElroy
New Contributor
I want to set the MaximumResolution property so that you can't zoom out past the full extent of the largest layer in a map pack.  Is there a way to programmatically get that value so that when you change map packs it can automatically calculate that?

Also, is there a way to force the map object to limit the pan range so you can't pan way over past the edge of the world and then zoom into whitespace and get lost?

Thanks,

James
0 Kudos
12 Replies
MichaelBranscomb
Esri Frequent Contributor
Hi,

Re Full Extent of Map Package:

If you use the LocalMapService class to work with Map Packages then you have the access to the FullExtent property as soon as the local map service is initialized. Alternatively, you'll get the same extent value from the FullExtent property of the LocalArcGISDynamicMapServiceLayer which will be populated during the layer initialization. In this case, you can either use the LayersInitialized event as you have, or if you want to listen for a specific layer, you can use the Initialized event on the layer, for example:

localArcGISDynamicMapServiceLayer.Initialized += (s, e) =>
{
// Do something with localMapService.FullExtent.
};
MapControl.Layers.Insert(1, localArcGISDynamicMapServiceLayer);


Re Reference/Schema:

Sorry - you shouldn't need xmlns:esriBehaviors="clr-namespace:ESRI.ArcGIS.Client.Behaviors;assembly=ESRI.ArcGIS.Client.Behaviors" - just xmlns:esri="http://schemas.esri.com/arcgis/client/2009" should work.


Cheers

Mike
0 Kudos
JamesMcElroy
New Contributor

Re Reference/Schema:

Sorry - you shouldn't need xmlns:esriBehaviors="clr-namespace:ESRI.ArcGIS.Client.Behaviors;assembly=ESRI.ArcGIS.Client.Behaviors" - just xmlns:esri="http://schemas.esri.com/arcgis/client/2009" should work.


Hi Mike,

Without that reference line I get these two errors when attempting to compile.

Error 142 ''esriBehaviors' is an undeclared prefix. Line 12, position 18.' XML is not valid.
Error 152 The type 'esriBehaviors:ConstrainExtentBehavior' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.

With the reference line compiles and works...
0 Kudos
MichaelBranscomb
Esri Frequent Contributor
Hi,

Yes - that correct - you can drop the esriBehaviors prefix and just use the esri prefix/namespace you have already declared.

Cheers

Mike
0 Kudos