4

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

ArcEngine 10, VS2010, C#

0

3 Answers 3

6

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

2
  • 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, 2011 at 19:03
  • I've added the link which you are supposed to find. Using lmgtfy is educational here.
    – johanvdw
    Feb 24, 2011 at 19:06
4

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

4

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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