# Detecting Shapefile Feature type

**URL:** <https://community.thinkgeo.com/t/detecting-shapefile-feature-type/264>\
**Category:** WinForms\
**Created:** [February 27, 2009, 8:02am UTC](https://community.thinkgeo.com/t/detecting-shapefile-feature-type/264 "2009-02-27T08:02:05Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nelson](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/n/dec6dc/32.png) [@Nelson](https://community.thinkgeo.com/u/Nelson)\
**Post date:** [February 27, 2009, 8:02am UTC](https://community.thinkgeo.com/t/detecting-shapefile-feature-type/264/1 "2009-02-27T08:02:05Z")

</div>

Is&nbsp;there&nbsp;a&nbsp;built-in&nbsp;mechanism&nbsp;for&nbsp;detecting&nbsp;whether&nbsp;the&nbsp;Shapefile&nbsp;is&nbsp;of&nbsp;LINE&nbsp;POINT&nbsp;OR&nbsp;POLYGON&nbsp;type?&nbsp;Just&nbsp;wondering.

&nbsp;

&nbsp;

---

<div class="post-metadata">

**Author:** ![Allen](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/a/bbce88/32.png) [@Allen](https://community.thinkgeo.com/u/Allen)\
**Post date:** [February 27, 2009, 8:17am UTC](https://community.thinkgeo.com/t/detecting-shapefile-feature-type/264/2 "2009-02-27T08:17:39Z")

</div>

Oh&nbsp;yes,&nbsp;I’d&nbsp;like&nbsp;to&nbsp;know&nbsp;that&nbsp;too…I&nbsp;have&nbsp;an&nbsp;app&nbsp;that&nbsp;helps&nbsp;build&nbsp;styles&nbsp;and&nbsp;it&nbsp;would&nbsp;be&nbsp;nice&nbsp;to&nbsp;let&nbsp;the&nbsp;user&nbsp;to&nbsp;just&nbsp;set&nbsp;the&nbsp;style&nbsp;for&nbsp;a&nbsp;layer’s&nbsp;feature&nbsp;type…nothing&nbsp;gained&nbsp;by&nbsp;setting&nbsp;a&nbsp;line&nbsp;or&nbsp;area&nbsp;style&nbsp;for&nbsp;a&nbsp;point.&nbsp;&nbsp;I&nbsp;poked&nbsp;around&nbsp;a&nbsp;layer’s&nbsp;innards&nbsp;a&nbsp;few&nbsp;months&nbsp;ago&nbsp;and&nbsp;couldn’t&nbsp;find&nbsp;anything.&nbsp;&nbsp;  
&nbsp;&nbsp;  
&nbsp;Allen

---

<div class="post-metadata">

**Author:** ![Nelson](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/n/dec6dc/32.png) [@Nelson](https://community.thinkgeo.com/u/Nelson)\
**Post date:** [February 27, 2009, 8:44am UTC](https://community.thinkgeo.com/t/detecting-shapefile-feature-type/264/3 "2009-02-27T08:44:54Z")

</div>

I'm&nbsp;sure&nbsp;we&nbsp;could&nbsp;acheive&nbsp;this&nbsp;by&nbsp;looking&nbsp;at&nbsp;the&nbsp;Column&nbsp;"SHAPE"&nbsp;as&nbsp;its&nbsp;value&nbsp;will&nbsp;be&nbsp;either&nbsp;Polygon&nbsp;Line&nbsp;or&nbsp;Point&nbsp;so&nbsp;long&nbsp;as&nbsp;you&nbsp;are&nbsp;using&nbsp;a&nbsp;standard&nbsp;shapefile&nbsp;(I&nbsp;believe).&nbsp;I&nbsp;just&nbsp;wanted&nbsp;to&nbsp;know&nbsp;if&nbsp;there&nbsp;was&nbsp;a&nbsp;built-in&nbsp;function&nbsp;so&nbsp;I&nbsp;didn't&nbsp;re-create&nbsp;the&nbsp;wheel.&nbsp;Thanks&nbsp;again.

---

<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:** [March 1, 2009, 9:44pm UTC](https://community.thinkgeo.com/t/detecting-shapefile-feature-type/264/4 "2009-03-01T21:44:46Z")

</div>

&nbsp;

Nelson&nbsp;and&nbsp;Allen,

Here&nbsp;is&nbsp;the&nbsp;built-in&nbsp;method&nbsp;you&nbsp;are&nbsp;looking&nbsp;for.

`ShapeFileFeatureLayer statesLayer = new ShapeFileFeatureLayer"USStates.shp");statesLayer.Open();ShapeFileType type = statesLayer.GetShapeFileType();`

One&nbsp;thing&nbsp;to&nbsp;be&nbsp;aware&nbsp;is&nbsp;that&nbsp;the&nbsp;ShapeFileType&nbsp;not&nbsp;only&nbsp;includes&nbsp;Point,&nbsp;PolyLine,&nbsp;Polygon,&nbsp;MultiPoint,&nbsp;MultiPolyLine&nbsp;and&nbsp;MultiPolygon,&nbsp;it&nbsp;also&nbsp;includes&nbsp;other&nbsp;types&nbsp;like&nbsp;MultiPointM&nbsp;or&nbsp;MultiPointZ.&nbsp;For&nbsp;more&nbsp;information,&nbsp;please&nbsp;see&nbsp;Page&nbsp;4&nbsp;of&nbsp;[esri.com/library/whitepa...pefile.pdf](http://www.esri.com/library/whitepapers/pdfs/shapefile.pdf)

Allen,&nbsp;you&nbsp;can&nbsp;use&nbsp;PointStyle&nbsp;to&nbsp;render&nbsp;all&nbsp;the&nbsp;point&nbsp;related&nbsp;types(Point,&nbsp;MultiPoint,&nbsp;MultiPointM&nbsp;and&nbsp;MultiPointZ),&nbsp;it's&nbsp;similar&nbsp;for&nbsp;LineStyle&nbsp;and&nbsp;AreaStyle&nbsp;too.

Thanks,

Ben

---

<div class="post-metadata">

**Author:** ![Nelson](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/n/dec6dc/32.png) [@Nelson](https://community.thinkgeo.com/u/Nelson)\
**Post date:** [March 2, 2009, 11:08am UTC](https://community.thinkgeo.com/t/detecting-shapefile-feature-type/264/5 "2009-03-02T11:08:05Z")

</div>

That's&nbsp;great,&nbsp;Ben.&nbsp;Thos&nbsp;various&nbsp;types&nbsp;can&nbsp;be&nbsp;filtered&nbsp;down&nbsp;to&nbsp;the&nbsp;base&nbsp;types.&nbsp;Thank&nbsp;you&nbsp;again.

---

<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:** [March 2, 2009, 7:27pm UTC](https://community.thinkgeo.com/t/detecting-shapefile-feature-type/264/6 "2009-03-02T19:27:16Z")

</div>

That’s&nbsp;my&nbsp;pleasure,&nbsp;Nelson.

---

<div class="post-metadata">

**Author:** ![Amila](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/a/c37758/32.png) [@Amila](https://community.thinkgeo.com/u/Amila)\
**Post date:** [October 17, 2011, 4:37am UTC](https://community.thinkgeo.com/t/detecting-shapefile-feature-type/264/7 "2011-10-17T04:37:23Z")

</div>

Hi&nbsp;All,&nbsp;  
&nbsp;&nbsp;  
&nbsp;One&nbsp;more&nbsp;question&nbsp;to&nbsp;add&nbsp;here.&nbsp;How&nbsp;detect&nbsp;SRID&nbsp;of&nbsp;the&nbsp;ShapeFileFeatureLayer.&nbsp;I&nbsp;have&nbsp;notice&nbsp;there&nbsp;is&nbsp;a&nbsp;property&nbsp;in&nbsp;postgresfeatureLayer&nbsp;as&nbsp;SRID.&nbsp;Isn’t&nbsp;there&nbsp;any&nbsp;work&nbsp;around&nbsp;to&nbsp;get&nbsp;projection&nbsp;text&nbsp;even?&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks&nbsp;  
&nbsp;Amila

---

<div class="post-metadata">

**Author:** ![Clint](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/c/da6949/32.png) [@Clint](https://community.thinkgeo.com/u/Clint)\
**Post date:** [October 17, 2011, 10:51am UTC](https://community.thinkgeo.com/t/detecting-shapefile-feature-type/264/8 "2011-10-17T10:51:28Z")

</div>

&nbsp;Amilia,

&nbsp;  
Thanks&nbsp;for&nbsp;your&nbsp;question!  
&nbsp;  
Typically&nbsp;projection&nbsp;information&nbsp;for&nbsp;shapefiles&nbsp;is&nbsp;saved&nbsp;in&nbsp;a&nbsp;\*.prj&nbsp;file&nbsp;along&nbsp;with&nbsp;the&nbsp;other&nbsp;shapefile&nbsp;files.&nbsp;&nbsp;Here&nbsp;is&nbsp;a&nbsp;link&nbsp;to&nbsp;a&nbsp;sample&nbsp;that&nbsp;shows&nbsp;how&nbsp;to&nbsp;read&nbsp;the&nbsp;\*.prj&nbsp;information&nbsp;and&nbsp;get&nbsp;the&nbsp;right&nbsp;projection&nbsp;information.  
&nbsp;  
[wiki.thinkgeo.com/wiki/Map\_S...g\_Prj\_File](http://wiki.thinkgeo.com/wiki/Map_Suite_Web_Edition_Projection_Samples#Projection_by_Analyzing_Prj_File)  
&nbsp;  
Let&nbsp;us&nbsp;know&nbsp;if&nbsp;you&nbsp;have&nbsp;any&nbsp;additional&nbsp;questions.  
&nbsp;  
Thanks!
