6

My shapefile has a number of fields, like roadname, and street number. Is there a way to get at these without converting the shapefile first into a featureclass (mdb)? Sometimes the conversion is a time consuming operation.

I'm using ArcEngine 10 C# with VS2010

8

Yes, a shapefile in this context is a feature class just like any other feature class, regardless where it resides, be it folder-based (shapefiles), geodatabase or SDE workspace. There is no need for any conversion.

Just open the shapefile feature class from the workspace and access the Fields property on the shapefile table. If you need to query for the actual data, you can use (for example) the IFeatureClass.Search method.

6

To just see that other fields without caring about the geometry data, you can just open the dbf-file in any Excel, open office or something else reading dbf-files.

Just be careful not to add or remove any rows, since that will corrupt the shapefile.

/Nicklas

  • This got me thinking - one good thing about Excel 2007 not being able to save as DBF anymore is that you cannot corrupt a shapefile with it :-) – Petr Krebs Dec 21 '10 at 23:28
1

Are you opposed to using open source libraries? There are quite a few .NET options for dealing with Shapefiles. I've had very good results with the OGR (C# bindings) and SharpMap. A quick search on google yields many more options.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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