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.
Solved! Go to Solution.
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
Hi,
What happens if you set the MaximumResolution property of the KmlLayer?
Cheers
Mike
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.
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
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