Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

How can I programmatically determine if a shapefile contains points, polygons, or lines?

ArcEngine 10, VS2010, C#

share|improve this question
add comment

3 Answers 3

up vote 4 down vote accepted

you can iterate through the geometry features and determine the type of the geometry feature in a conditional statement using the GetGeometryType method I suggest you go through the API found here: http://geoinformatics.tkk.fi/doc/Geo-GDAL/html/class_geo_1_1_o_g_r_1_1_geometry.html

share|improve this answer
add comment

Searching for arcengine+shapetype will help you find: IFeatureClass Or much faster if you like: check byte 32-35 of the file http://en.wikipedia.org/wiki/Shapefile

share|improve this answer
2  
The problem with links to google in an answer (in general) is that there's a good chance that the #1 result in a little while will be this question. (Assuming this site will accumulate the sort of googlejuice that StackOverflow.com has...) Also, LMGTFY is a touch snarky, which I appreciate, but not everyone does. ;) –  Dan S. Feb 24 '11 at 19:03
    
I've added the link which you are supposed to find. Using lmgtfy is educational here. –  johanvdw Feb 24 '11 at 19:06
add comment

You can use IFeatureclass.ShapeType. Opening a featureclass is a bit expensive, I bet johanvdw's method is faster.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.