ThinkGeo.com    |     Documentation    |     Premium Support

CurrentExtent modification doesn't reflect input

Hi,


When I set the CurrentExtent of my WpfMap, it doesn't seem to use the values I supply, but the CurrentExtent does in fact change.  


What influences the CurrentExtent setter to cause this to happen?


I'm trying to write a function that "zooms to" a feature by setting the CurrentExtent to a feature's bounding box, along with calling CenterAt, but the CurrentExtent setter seems to be applying some rules that I'm not aware of yet.


Thanks,


Greg



Greg, 
  
 Yes, you are right.  
  
 The default behavior of CurrentExtent property is like this, because the default of ZoomLevelSnappingMode is SnapUp, so the CurrentExtent always will be snap up to the certain zoom level.  
  
 If you use ExtentHelper.ZoomToScale method by passing in the scale of any zoom level, the result rectangle shape will reflect if you set it to CurrentExtent. If you want to CurrentExtent does in fact change, you can set ZoomLevelSnappingMode to None. 
  
 Please let me know if you have more questions 
  
 Thanks 
  
 James 


Thanks!



You are welcome, Greg. 
  
 Any more questions please let us know. 
  
 Thanks, 
  
 Sun 


I have some more CurrentExtent questions.  
  
 The follow steps are strange to me (Note ZoomLevelSnapping is set to None): 
 1) CurrentExtent starts out with {-90,50.7857125997543,90,-50.7857125997543} 
 2) If I Set CurrentExtent to {-95.5727883333333,29.6343883333333,-95.5727783333333,29.6316005555556} 
 3) then CurrentExtent becomes {-90,50.7857125997543,90,-50.7857125997543} 
 4) Then I Call CenterAt with {-95.5727833333333,29.6329944444444,0} 
 5) and CurrentExtent becomes {-185.572783333333,80.4187070441988,-5.57278333333335,-21.1527181553099} 
  
 Basically, what I’m trying to do is center my map on my features, and something within the WpfMap is preventing my values from taking.  Please help! 
  
 Thanks, 
 Greg 


Greg,


The problem is that when you try to set the CurrentExtent to {-95.5727883333333,29.6343883333333,-95.5727783333333,29.6316005555556} the scale will be very small, and the value would smaller than MinimumScale, so the current extent won't change, you can set the MinimunScale to solve this problem, for example:

 


wpfMap1.MinimumScale = 0;

Thanks


James


 



Thanks James!  Works like a charm.



Greg, 
  
 You’re welcome, I am very glad it’s working with you. 
  
 I am researching your another problem, if I get something I will let you know. 
  
 James