How to get the FeatureType of a FeatureClass

222
2
06-03-2020 05:40 AM
EvaSchuh
New Contributor

I am trying to programmatically get the FeatureType of a FeatureClass with the ArcGIS Pro SDK.

More precisely I would like to find out if the FeatureClass is of type Annotation.

I already tried opening the definition of type AnnotationFeatureClassDefinition.

This does not work (returns null):

Geodatabase.GetDefinition<AnnotationFeatureClassDefinition>("myAnnotation")

I can get the FeatureClassDefinition: 

Geodatabase.GetDefinition<FeatureClassDefinition>("myAnnotation")

But how do I get the FeatureType? 

I am using ArcGIS.Core/ArcGIS.CoreHost in a standalone application.

Does anybody know how to do this?

0 Kudos
2 Replies
RichRuh
Esri Regular Contributor

If you're starting from a FeatureClass object, just try to cast it to an AnnotationFeatureClass:

FeatureClasss myFeatureClass;
...
if (myFeatureClass is AnnotationFeatureClass)
{
  AnnotationFeatureClass myAnnotationFeatureClass = myFeatureClass as AnnotationFeatureClass;
  ...
}

Is this what you are looking for?

--Rich

0 Kudos
EvaSchuh
New Contributor

Thanks, Rich. I was testing with Annotation-FeatureClasses created with ArcGIS Desktop 10.5. 

I now have an Annotation-Featureclass created with ArcGIS Pro and I can either get the AnnotationClassDefinition directly or cast FeatureClass into AnnotationFeatureClass.

0 Kudos