# Display and Zoom To Position

**URL:** <https://community.thinkgeo.com/t/display-and-zoom-to-position/1309>\
**Category:** WinForms\
**Created:** [June 27, 2010, 9:19pm UTC](https://community.thinkgeo.com/t/display-and-zoom-to-position/1309 "2010-06-27T21:19:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Steve1](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/s/3da27b/32.png) [@Steve1](https://community.thinkgeo.com/u/Steve1)\
**Post date:** [June 27, 2010, 9:19pm UTC](https://community.thinkgeo.com/t/display-and-zoom-to-position/1309/1 "2010-06-27T21:19:55Z")

</div>

I&nbsp;am&nbsp;converting&nbsp;v2&nbsp;code&nbsp;to&nbsp;v4.&nbsp;I&nbsp;am&nbsp;trying&nbsp;to&nbsp;display&nbsp;the&nbsp;current&nbsp;position&nbsp;(supplied&nbsp;via&nbsp;GPS)&nbsp;and&nbsp;zoom&nbsp;in&nbsp;to&nbsp;display&nbsp;it.&nbsp;Previously&nbsp;I&nbsp;used&nbsp;MapShape&nbsp;to&nbsp;do&nbsp;this&nbsp;so&nbsp;the&nbsp;code&nbsp;needs&nbsp;a&nbsp;complete&nbsp;re-write.

I&nbsp;have&nbsp;come&nbsp;up&nbsp;with&nbsp;this&nbsp;to&nbsp;display&nbsp;the&nbsp;position:

`    InMemoryFeatureLayer inMemoryLayer = new InMemoryFeatureLayer();    PointShape currentPos = new PointShape(gpsPosition.Easting, gpsPosition.Northing);    inMemoryLayer.InternalFeatures.Add("Position", new Feature(currentPos));       inMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle =         new PointStyle(PointSymbolType.Star, new GeoSolidBrush(GeoColor.StandardColors.Red), new GeoPen(GeoColor.StandardColors.Black), 14);    LayerOverlay gpsOverlay = GetOverlay("GpsOverlay");    gpsOverlay.Layers.Add(inMemoryLayer);`

Is&nbsp;this&nbsp;the&nbsp;way&nbsp;to&nbsp;do&nbsp;it?

Next&nbsp;I&nbsp;want&nbsp;to&nbsp;zoom&nbsp;in.&nbsp;Previously&nbsp;I&nbsp;used&nbsp;this&nbsp;code:

`    Dim ell As Ellipse = currentPos.Buffer(100, MapLengthUnits.metres, MapLengthUnits.metres)    Dim rect As StraightRectangle = ell.Envelope    rect.ScaleUp(100)    Map1.CurrentExtent = rect.ToRectangleR`

But&nbsp;.Buffer&nbsp;now&nbsp;returns&nbsp;a&nbsp;MultipolygonShape&nbsp;not&nbsp;an&nbsp;ellipse.&nbsp;What&nbsp;is&nbsp;the&nbsp;best&nbsp;way&nbsp;to&nbsp;do&nbsp;this?

Cheers

Steve

---

<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:** [June 27, 2010, 9:44pm UTC](https://community.thinkgeo.com/t/display-and-zoom-to-position/1309/2 "2010-06-27T21:44:50Z")

</div>

Steve,

Thanks&nbsp;for&nbsp;your&nbsp;post&nbsp;and&nbsp;questions.  
&nbsp;  
First&nbsp;I&nbsp;want&nbsp;to&nbsp;let&nbsp;you&nbsp;know&nbsp;that&nbsp;we&nbsp;created&nbsp;a&nbsp;sample&nbsp;just&nbsp;to&nbsp;follow&nbsp;the&nbsp;functionality&nbsp;of&nbsp;MapShapes&nbsp;existing&nbsp;in&nbsp;MapSuite&nbsp;2.x&nbsp;version.  
[code.thinkgeo.com/projects/show/mapshapes](http://code.thinkgeo.com/projects/show/mapshapes)  
&nbsp;  
The&nbsp;code&nbsp;shown&nbsp;using&nbsp;the&nbsp;InmemoryFeatureLayer&nbsp;is&nbsp;exactly&nbsp;what&nbsp;we&nbsp;are&nbsp;going&nbsp;to&nbsp;do&nbsp;in&nbsp;MapSuite&nbsp;4.x,&nbsp;that&nbsp;is&nbsp;it,&nbsp;you&nbsp;are&nbsp;perfectly&nbsp;right.  
&nbsp;  
About&nbsp;the&nbsp;MultipolygonShape&nbsp;instead&nbsp;of&nbsp;ellipse&nbsp;shape,&nbsp;I&nbsp;am&nbsp;not&nbsp;sure&nbsp;why&nbsp;you&nbsp;want&nbsp;to&nbsp;get&nbsp;is&nbsp;an&nbsp;ellipse&nbsp;shape&nbsp;instead&nbsp;of&nbsp;a&nbsp;MultipolygonShape,&nbsp;in&nbsp;fact,&nbsp;the&nbsp;ellipse&nbsp;shape&nbsp;itself&nbsp;is&nbsp;a&nbsp;Polygonshape&nbsp;with&nbsp;multiple&nbsp;points&nbsp;to&nbsp;looks&nbsp;like&nbsp;an&nbsp;ellipse.&nbsp;If&nbsp;we&nbsp;really&nbsp;want&nbsp;to&nbsp;get&nbsp;an&nbsp;ellipse&nbsp;shape&nbsp;instead&nbsp;of&nbsp;a&nbsp;MultipolygonShape,&nbsp;follow&nbsp;following&nbsp;steps&nbsp;to&nbsp;convert&nbsp;it:  
_Step1:&nbsp;Get&nbsp;the&nbsp;boundingBox&nbsp;of&nbsp;the&nbsp;multipolygonShape._  
_Step2:&nbsp;Get&nbsp;the&nbsp;width&nbsp;and&nbsp;height&nbsp;of&nbsp;the&nbsp;boundingbox._  
_Step3:&nbsp;Get&nbsp;the&nbsp;center&nbsp;of&nbsp;the&nbsp;boundingbox._  
_Step4:&nbsp;Create&nbsp;an&nbsp;ellipse&nbsp;with&nbsp;the&nbsp;width,&nbsp;height,&nbsp;center._  
&nbsp;  
Any&nbsp;more&nbsp;questions&nbsp;just&nbsp;feel&nbsp;free&nbsp;to&nbsp;let&nbsp;me&nbsp;know.  
&nbsp;  
Thanks.  
&nbsp;  
Yale

---

<div class="post-metadata">

**Author:** ![Steve1](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/s/3da27b/32.png) [@Steve1](https://community.thinkgeo.com/u/Steve1)\
**Post date:** [June 27, 2010, 10:48pm UTC](https://community.thinkgeo.com/t/display-and-zoom-to-position/1309/3 "2010-06-27T22:48:18Z")

</div>

Thanks&nbsp;Yale.&nbsp;  
&nbsp;&nbsp;  
&nbsp;I&nbsp;really&nbsp;needed&nbsp;a&nbsp;bounding&nbsp;box&nbsp;so&nbsp;I&nbsp;could&nbsp;set&nbsp;the&nbsp;new&nbsp;map&nbsp;extent&nbsp;but&nbsp;I&nbsp;got&nbsp;that&nbsp;from&nbsp;the&nbsp;MultipolygonShape.&nbsp;  
&nbsp;&nbsp;  
&nbsp;All&nbsp;working&nbsp;now.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Cheers&nbsp;  
&nbsp;&nbsp;  
&nbsp;Steve

---

<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:** [June 28, 2010, 3:36am UTC](https://community.thinkgeo.com/t/display-and-zoom-to-position/1309/4 "2010-06-28T03:36:20Z")

</div>

Steve,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks&nbsp;for&nbsp;letting&nbsp;me&nbsp;know&nbsp;your&nbsp;status,I&nbsp;am&nbsp;glad&nbsp;seeing&nbsp;your&nbsp;progress.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Any&nbsp;more&nbsp;questions&nbsp;just&nbsp;feel&nbsp;free&nbsp;to&nbsp;let&nbsp;me&nbsp;know.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Yale
