Hi,
I am using jpg image file for the map image. I want to restrict the zoomlevel based on the image quality (resolution). How can i fo that efficiently? Any suggestions.
Thanks
Raquib
Hi,
I am using jpg image file for the map image. I want to restrict the zoomlevel based on the image quality (resolution). How can i fo that efficiently? Any suggestions.
Thanks
Raquib
Raquibur,
I see, but you still have to define the relationship between maximum and minimum scale. I post my basic logic here and free to modify it.
GdiPlusRasterLayer layer = new GdiPlusRasterLayer("C:\\Share\\world.jpg");
layerOverlay.Layers.Add(layer);
layer.Open();
RectangleShape layerExtent = layer.GetBoundingBox();
double maxScale = ExtentHelper.GetScale(layerExtent, (float)Map1.ActualWidth, Map1.MapUnit);
// Modify 3 to any other value which means how many level lower than the maximum scale
double minScale = maxScale / Math.Pow(2, 3);
layer.Close();
Map1.MaximumScale = maxScale;
Map1.MinimumScale = minScale;
// You can also set the scale on the layer
//layer.UpperThreshold = maxScale;
//layer.LowerThreshold = minScale;
Let me know if you have any questions.
Thanks,
Howard
Raquibur,
I just wanted to ask some questions to clarify something. Did you want to not allow any zooming below a certain scale because your image gets pixelated? Are you displaying other data besides this picture that need other zoom levels? Do you want to limit the area the use can see to the extent of the image as well? If you can give us some more insight into what you are doing and what you are trying to achieve we can better help you. The more information the better. :-)
David
Howard Thanks for the sample code. I will try to implement that in my code.
David, I am using custom image for map data. So i want to not allow any zooming below a certain scale because the images gets pixelated.
Raquibur,
Okay, just let me know if you have more queries.
Thanks,
Howard