Select to view content in your preferred language

Zoom to scale

572
2
11-28-2011 10:17 AM
GregoryDillon
Occasional Contributor
I'm not sure how to change the math for the example in http://forums.esri.com/Thread.asp?c=213&f=2455&t=285205 for NM State Plane (2903) and Units = ersiFeet.   Specifically what do I use instead of 39.37 (inches per meter)?  Should this be 12 (inches per foot)?    Also what should use instead of mapunitInMeters (see snippit below)? 


private void zoomToScaleCombo_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (MyMap == null) return;
double dpi = 96; //Set to resolution of your screen
double scale = double.Parse((e.AddedItems[0] as ComboBoxItem).Tag.ToString());
double mapunitInMeters = 111319.5; //size of one degree at Equator. Change if you are using a projection with a different unit than degrees
double newRes = scale / (dpi * 39.37 * mapunitInMeters);
MyMap.ZoomToResolution(newRes);
}


Would this logic be (12 inch = 1 foot and since the mapunit is in feet this value would be 1)?

double newRes = scale / (dpi * 12 * 1);

or more simply

double newRes = scale / (dpi * 12);
0 Kudos
2 Replies
DominiqueBroux
Esri Frequent Contributor
Not sure what is the question, but double newRes = scale / (dpi * 12); looks good to me.
0 Kudos
GregoryDillon
Occasional Contributor
I just wanted to make sure I had the formula right for my projection (NM State Plane) and Feet based units.   I guess the project really doesn't matter as long as the units are in feet.  

You told me what I need to know.

Thanks.
0 Kudos