Register  |  Login
ThinkGeo - GPS Tracking and Mapping Solutions  |  Visit the Wiki  |  Find us on: Twitter Facebook Google+ LinkedIn

Discussion Forums

The online community for users of Map Suite GIS components

Restrict zoom based on Image resolution
Last Post 07-16-2010 01:10 AM by Howard. 5 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
RaquiburUser is Offline
Level 3
Level 3
Posts:70
Avatar

--
07-14-2010 08:16 PM

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

HowardUser is Offline
MVP
MVP
Posts:1406
Avatar

--
07-15-2010 12:39 AM

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

DavidUser is Offline
MVP
MVP
Posts:1534
Avatar

--
07-15-2010 04:12 AM
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
- Need sample code? Check out the Map Suite Code Community at http://code.thinkgeo.com
RaquiburUser is Offline
Level 3
Level 3
Posts:70
Avatar

--
07-15-2010 12:03 PM
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.
RaquiburUser is Offline
Level 3
Level 3
Posts:70
Avatar

--
07-15-2010 12:50 PM

 

HowardUser is Offline
MVP
MVP
Posts:1406
Avatar

--
07-16-2010 01:10 AM
Raquibur,

Okay, just let me know if you have more queries.

Thanks,
Howard
You are not authorized to post a reply.

Active Forums 4.2