KLM layer sets Max/Min resolution

2511
4
Jump to solution
07-15-2014 04:42 AM
Labels (1)
BjørnarSundsbø
Occasional Contributor

I'm working with KmlLayer as the DataSource in Runtime SDK for WPF to allow the user to create their own content, but I have discovered that the layer sets MaximumResolution based on the graphics inside of it, which I find to be very inconvenient. Imagine displaying flight paths across parts of the country, but when zooming out beyond the features, they suddenly disappear. I would have liked it if this was a feature that could be disabled through a property.

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
MichaelBranscomb
Esri Frequent Contributor

Hi,

I believe you will always need to know the Spatial Reference of the Map in order to determine the effective minimum and maximum scale values of layer within the Map. There is a method on the Geometry class to help calculate this - ESRI.ArcGIS.Client.Geometry.Geometry.GetScale() - but it does require either a double representing the meters per unit or the actual spatial reference itself. Therefore you will need to wait until the Map is initialized with a spatial reference which should determine the spatial reference of the layer within the map. Unfortunately I cannot say at this time whether we could easily add this to the existing WPF API since it may well require some reworking of the layer / map initialization.

However, as you have noted, in response to feedback we have implemented scale on layers in the new .NET SDK.

Cheers

Mike

View solution in original post

0 Kudos
4 Replies
MichaelBranscomb
Esri Frequent Contributor

Hi,

What happens if you set the MaximumResolution property of the KmlLayer?

Cheers

Mike

0 Kudos
BjørnarSundsbø
Occasional Contributor

Besides making me slightly embarrassed, it works. Refreshing the layer does not overwrite the initial value I set from outside.

The thing that lead me to this "problem" was that I was trying to implement MaximumScale rather than MaximumResolution, but there was some fuzzy logic that mislead me. When the layer has been initialized, I try to calculate the resolution from the scale configured by the user, but that fails as a result of SpatialReference not being available for the layer. This property is never set for my layer. Would you happen to have any suggestions on how to implement Maximum/Minimum Scale without any knowledge of anything outside of the layer? Is this something you could add in a future version? I want this to be a general implementation for all layer types, and using reflection to get the Map from the layer seems a bit dirty. I notice these properties are available for the Runtime SDK for .NET, but we haven't started using this yet, as there are still things missing, such as KML layer, among other things.

0 Kudos
MichaelBranscomb
Esri Frequent Contributor

Hi,

I believe you will always need to know the Spatial Reference of the Map in order to determine the effective minimum and maximum scale values of layer within the Map. There is a method on the Geometry class to help calculate this - ESRI.ArcGIS.Client.Geometry.Geometry.GetScale() - but it does require either a double representing the meters per unit or the actual spatial reference itself. Therefore you will need to wait until the Map is initialized with a spatial reference which should determine the spatial reference of the layer within the map. Unfortunately I cannot say at this time whether we could easily add this to the existing WPF API since it may well require some reworking of the layer / map initialization.

However, as you have noted, in response to feedback we have implemented scale on layers in the new .NET SDK.

Cheers

Mike

0 Kudos
BjørnarSundsbø
Occasional Contributor

Hi,

Thank you for your quick response. I was already using Geometry.GetResolution(double, SpatialReference), but as you say, I already need the correct spatial reference to do that. Now that I have confirmed my suspicions, I will try to find a way to work with this.

Cheers

Bjørnar

0 Kudos