# Bounding Box of a MSSQL2008FeatureLayer

**URL:** <https://community.thinkgeo.com/t/bounding-box-of-a-mssql2008featurelayer/196>\
**Category:** WinForms\
**Created:** [January 29, 2009, 1:26pm UTC](https://community.thinkgeo.com/t/bounding-box-of-a-mssql2008featurelayer/196 "2009-01-29T13:26:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Clint1](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/c/f6c823/32.png) [@Clint1](https://community.thinkgeo.com/u/Clint1)\
**Post date:** [January 29, 2009, 1:26pm UTC](https://community.thinkgeo.com/t/bounding-box-of-a-mssql2008featurelayer/196/1 "2009-01-29T13:26:45Z")

</div>

Hi,

Is&nbsp;there&nbsp;any&nbsp;api&nbsp;off&nbsp;of&nbsp;the&nbsp;MSQL2008FeatureLayer&nbsp;to&nbsp;get&nbsp;the&nbsp;bounding&nbsp;box&nbsp;of&nbsp;that&nbsp;contains&nbsp;all&nbsp;the&nbsp;features?&nbsp;

Thanks!

&nbsp;

---

<div class="post-metadata">

**Author:** ![Charles](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/c/6f9a4e/32.png) [@Charles](https://community.thinkgeo.com/u/Charles)\
**Post date:** [January 30, 2009, 8:40am UTC](https://community.thinkgeo.com/t/bounding-box-of-a-mssql2008featurelayer/196/2 "2009-01-30T08:40:47Z")

</div>

The&nbsp;following&nbsp;code&nbsp;seems&nbsp;to&nbsp;work&nbsp;for&nbsp;my&nbsp;project.&nbsp;&nbsp;I&nbsp;imported&nbsp;the&nbsp;US&nbsp;States&nbsp;and&nbsp;Austin&nbsp;Streets&nbsp;Shape&nbsp;files&nbsp;into&nbsp;an&nbsp;SQLExpress&nbsp;08&nbsp;Spatial&nbsp;database.&nbsp;&nbsp;This&nbsp;only&nbsp;gets&nbsp;the&nbsp;bounding&nbsp;box&nbsp;for&nbsp;one&nbsp;layer&nbsp;not&nbsp;all&nbsp;layers&nbsp;added&nbsp;to&nbsp;the&nbsp;map&nbsp;window.

`                winformsMap1.MapUnit = GeographyUnit.DecimalDegree;                MsSql2008FeatureLayer streetsAustinLayer = new MsSql2008FeatureLayer(@"Server=CHARLESRLAPTOP\SQLEXPRESS;Database=MapSuite;Trusted_Connection=True;", "Austinstreets", "ID");                streetsAustinLayer.ZoomLevelSet.ZoomLevel08.DefaultLineStyle.OuterPen.Width = 1;                streetsAustinLayer.ZoomLevelSet.ZoomLevel08.DefaultLineStyle.OuterPen.Color = GeoColor.StandardColors.Black;                streetsAustinLayer.ZoomLevelSet.ZoomLevel08.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;                streetsAustinLayer.Name = "Austinstreets";                MsSql2008FeatureLayer statesUS = new MsSql2008FeatureLayer(@"Server=CHARLESRLAPTOP\SQLEXPRESS;Database=MapSuite;Trusted_Connection=True;", "USStates", "ID");                statesUS.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.OutlinePen.Width = 1;                statesUS.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.OutlinePen.Color = GeoColor.StandardColors.Black;                statesUS.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;                statesUS.Name = "statesUS";                winformsMap1.DynamicOverlay.Layers.Add(statesUS.Name, statesUS);                winformsMap1.DynamicOverlay.Layers.Add(streetsAustinLayer.Name, streetsAustinLayer);                //                winformsMap1.CurrentExtent = new RectangleShape(-182, 76, -56, 16);   //Use this for US States                //                winformsMap1.CurrentExtent = new RectangleShape(-97.82, 30.38, -97.65, 30.21);  /use this for just Aurtin Streets                statesUS.Open();                winformsMap1.CurrentExtent = statesUS.GetBoundingBox();`

---

<div class="post-metadata">

**Author:** ![Ben](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/ben/32/25720_2.png) [@Ben](https://community.thinkgeo.com/u/Ben)\
**Post date:** [February 2, 2009, 2:51am UTC](https://community.thinkgeo.com/t/bounding-box-of-a-mssql2008featurelayer/196/3 "2009-02-02T02:51:01Z")

</div>

Clint,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Charles&nbsp;is&nbsp;correct&nbsp;that&nbsp;the&nbsp;method&nbsp;GetBoundingBox()&nbsp;is&nbsp;what&nbsp;you&nbsp;need.&nbsp;&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks&nbsp;Charles&nbsp;:)&nbsp;  
&nbsp;&nbsp;  
&nbsp;Ben
