# This is likely an easy one

**URL:** <https://community.thinkgeo.com/t/this-is-likely-an-easy-one/1557>\
**Category:** WinForms\
**Created:** [January 16, 2011, 3:40pm UTC](https://community.thinkgeo.com/t/this-is-likely-an-easy-one/1557 "2011-01-16T15:40:19Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![David9](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/david9/32/24954_2.png) [@David9](https://community.thinkgeo.com/u/David9)\
**Post date:** [January 16, 2011, 3:40pm UTC](https://community.thinkgeo.com/t/this-is-likely-an-easy-one/1557/1 "2011-01-16T15:40:19Z")

</div>

&nbsp;...&nbsp;but&nbsp;I&nbsp;must&nbsp;have&nbsp;missed&nbsp;this&nbsp;day&nbsp;in&nbsp;class...

Let's&nbsp;say&nbsp;I&nbsp;load&nbsp;a&nbsp;raster&nbsp;with&nbsp;a&nbsp;world&nbsp;file.&nbsp;How&nbsp;do&nbsp;I&nbsp;limit&nbsp;the&nbsp;ability&nbsp;to&nbsp;zoom&nbsp;out&nbsp;to&nbsp;be&nbsp;a&nbsp;maximum&nbsp;of&nbsp;twice&nbsp;the&nbsp;'natural'&nbsp;extents&nbsp;of&nbsp;the&nbsp;raster?&nbsp;That&nbsp;is,&nbsp;I&nbsp;don't&nbsp;want&nbsp;the&nbsp;user&nbsp;to&nbsp;be&nbsp;able&nbsp;to&nbsp;zoom&nbsp;way&nbsp;way&nbsp;out,&nbsp;but&nbsp;to&nbsp;limit&nbsp;it&nbsp;so&nbsp;that&nbsp;at&nbsp;max&nbsp;zoom&nbsp;out,&nbsp;the&nbsp;largest&nbsp;dimension&nbsp;of&nbsp;the&nbsp;raster&nbsp;(X&nbsp;or&nbsp;Y)&nbsp;is&nbsp;50%&nbsp;of&nbsp;the&nbsp;available&nbsp;map&nbsp;dimension&nbsp;in&nbsp;that&nbsp;same&nbsp;direction.

Please&nbsp;see&nbsp;image&nbsp;for&nbsp;rough&nbsp;example

Dave

---

<div class="post-metadata">

**Author:** ![ThinkGeo](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/thinkgeo/32/25029_2.png) [@ThinkGeo](https://community.thinkgeo.com/u/ThinkGeo)\
**Post date:** [January 17, 2011, 8:14am UTC](https://community.thinkgeo.com/t/this-is-likely-an-easy-one/1557/2 "2011-01-17T08:14:00Z")

</div>

David,

Thanks&nbsp;for&nbsp;your&nbsp;post&nbsp;and&nbsp;question.  
Take&nbsp;a&nbsp;try&nbsp;on&nbsp;the&nbsp;following&nbsp;event,&nbsp;following&nbsp;is&nbsp;the&nbsp;code&nbsp;snippet&nbsp;you&nbsp;can&nbsp;reference,&nbsp;hope&nbsp;it&nbsp;can&nbsp;help.  
&nbsp;  
`winformsMap1.CurrentExtentChanging += new EventHandler<CurrentExtentChangingWinformsMapEventArgs>(winformsMap1_CurrentExtentChanging); void winformsMap1_CurrentExtentChanging(object sender, CurrentExtentChangingWinformsMapEventArgs e){     // You have to modify the condition here.     if (e.CurrentExtent.LowerLeftPoint.X > new RectangleShape(-118.098, 84.3, 118.098, -84.3).LowerLeftPoint.X)     {         e.Cancel = true;     }}`  
&nbsp;  
Any&nbsp;more&nbsp;questions&nbsp;please&nbsp;feel&nbsp;free&nbsp;to&nbsp;let&nbsp;me&nbsp;know.  
&nbsp;  
Thanks.  
&nbsp;  
Yale

---

<div class="post-metadata">

**Author:** ![David9](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/david9/32/24954_2.png) [@David9](https://community.thinkgeo.com/u/David9)\
**Post date:** [January 17, 2011, 8:57am UTC](https://community.thinkgeo.com/t/this-is-likely-an-easy-one/1557/3 "2011-01-17T08:57:11Z")

</div>

&nbsp;Thank&nbsp;you&nbsp;Yale,&nbsp;but&nbsp;I&nbsp;had&nbsp;a&nbsp;different&nbsp;approach&nbsp;in&nbsp;mind,&nbsp;tho&nbsp;I&nbsp;probably&nbsp;have&nbsp;an&nbsp;incomplete&nbsp;understanding&nbsp;of&nbsp;the&nbsp;zoom&nbsp;function.

Is&nbsp;it&nbsp;possible&nbsp;to&nbsp;set&nbsp;the&nbsp;area&nbsp;shown&nbsp;by&nbsp;ZoomLevel1&nbsp;to&nbsp;some&nbsp;calculated&nbsp;boundries&nbsp;larger&nbsp;than&nbsp;the&nbsp;loaded&nbsp;raster&nbsp;(don't&nbsp;worry&nbsp;about&nbsp;that&nbsp;calculation&nbsp;exactly)&nbsp;so&nbsp;that&nbsp;ZoomLevel1&nbsp;(or&nbsp;20?)&nbsp;represents&nbsp;the&nbsp;maximum&nbsp;zoom&nbsp;out&nbsp;I&nbsp;described?&nbsp;&nbsp;Then&nbsp;the&nbsp;other&nbsp;zoom&nbsp;levels&nbsp;would&nbsp;just&nbsp;work&nbsp;'in'&nbsp;from&nbsp;there?

Dave

---

<div class="post-metadata">

**Author:** ![ThinkGeo](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/thinkgeo/32/25029_2.png) [@ThinkGeo](https://community.thinkgeo.com/u/ThinkGeo)\
**Post date:** [January 18, 2011, 6:20am UTC](https://community.thinkgeo.com/t/this-is-likely-an-easy-one/1557/4 "2011-01-18T06:20:03Z")

</div>

David,

Thanks&nbsp;for&nbsp;your&nbsp;response.  
&nbsp;  
If&nbsp;I&nbsp;am&nbsp;not&nbsp;misunderstanding&nbsp;anything,&nbsp;your&nbsp;approach&nbsp;is&nbsp;likely&nbsp;to&nbsp;create&nbsp;customized&nbsp;zoomlevels,&nbsp;I&nbsp;agree&nbsp;that&nbsp;this&nbsp;will&nbsp;work&nbsp;while&nbsp;it&nbsp;is&nbsp;something&nbsp;we&nbsp;need&nbsp;to&nbsp;consider&nbsp;carefully&nbsp;about&nbsp;the&nbsp;scale&nbsp;values.  
&nbsp;  
Any&nbsp;more&nbsp;questions&nbsp;please&nbsp;feel&nbsp;free&nbsp;to&nbsp;let&nbsp;me&nbsp;know.  
&nbsp;  
Thanks.  
&nbsp;  
Yale

---

<div class="post-metadata">

**Author:** ![David9](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/david9/32/24954_2.png) [@David9](https://community.thinkgeo.com/u/David9)\
**Post date:** [January 19, 2011, 10:54am UTC](https://community.thinkgeo.com/t/this-is-likely-an-easy-one/1557/5 "2011-01-19T10:54:38Z")

</div>

&nbsp;How&nbsp;is&nbsp;Map.CurrentScale&nbsp;calculated?

Dave

---

<div class="post-metadata">

**Author:** ![ThinkGeo](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/thinkgeo/32/25029_2.png) [@ThinkGeo](https://community.thinkgeo.com/u/ThinkGeo)\
**Post date:** [January 20, 2011, 8:42am UTC](https://community.thinkgeo.com/t/this-is-likely-an-easy-one/1557/6 "2011-01-20T08:42:07Z")

</div>

Dave,&nbsp;  
&nbsp;&nbsp;  
&nbsp;The&nbsp;Map.CurrentScale&nbsp;is&nbsp;calculated&nbsp;by&nbsp;the&nbsp;static&nbsp;API&nbsp;GetScale&nbsp;provided&nbsp;in&nbsp;the&nbsp;ExtentHelper&nbsp;class,&nbsp;it&nbsp;need&nbsp;to&nbsp;input&nbsp;the&nbsp;map&nbsp;current&nbsp;extent&nbsp;and&nbsp;the&nbsp;map&nbsp;with&nbsp;and&nbsp;mapunit.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Any&nbsp;more&nbsp;questions&nbsp;please&nbsp;feel&nbsp;free&nbsp;to&nbsp;let&nbsp;me&nbsp;know.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Yale&nbsp;

---

<div class="post-metadata">

**Author:** ![David9](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/david9/32/24954_2.png) [@David9](https://community.thinkgeo.com/u/David9)\
**Post date:** [January 20, 2011, 8:50am UTC](https://community.thinkgeo.com/t/this-is-likely-an-easy-one/1557/7 "2011-01-20T08:50:46Z")

</div>

What&nbsp;units&nbsp;is&nbsp;the&nbsp;Scale&nbsp;in?&nbsp;&nbsp;(assuming&nbsp;my&nbsp;map&nbsp;is&nbsp;in&nbsp;meters)

&nbsp;

Dave

---

<div class="post-metadata">

**Author:** ![ThinkGeo](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/thinkgeo/32/25029_2.png) [@ThinkGeo](https://community.thinkgeo.com/u/ThinkGeo)\
**Post date:** [January 20, 2011, 9:36am UTC](https://community.thinkgeo.com/t/this-is-likely-an-easy-one/1557/8 "2011-01-20T09:36:21Z")

</div>

Dave,

I&nbsp;think&nbsp;there&nbsp;is&nbsp;no&nbsp;unit&nbsp;for&nbsp;the&nbsp;scale.&nbsp;Following&nbsp;links&nbsp;provide&nbsp;some&nbsp;information&nbsp;you&nbsp;can&nbsp;take&nbsp;a&nbsp;reference.  
[gif.berkeley.edu/documents/Scale\_in\_GIS.pdf](http://gif.berkeley.edu/documents/Scale_in_GIS.pdf)  
[gisdevelopment.net/tutorials/tuman002a.htm](http://www.gisdevelopment.net/tutorials/tuman002a.htm)  
[cedareden.com/cdea/gis/scale/frame.html](http://www.cedareden.com/cdea/gis/scale/frame.html)  
Any&nbsp;more&nbsp;questions&nbsp;please&nbsp;feel&nbsp;free&nbsp;to&nbsp;let&nbsp;me&nbsp;know.  
Thanks.  
Yale
