I have feature class with representation rules and now need to extract representation geometry from selected features. If representation geometry is manually overrided, I can get it just using IRepresentation.Shape property:

IFeatureLayer layer = someLayerMethod();
IGeoFeatureLayer geoLayer = (IGeoFeatureLayer)layer;
IFeatureClass mapFeatureClass = layer.FeatureClass;

ICursor cursor = (ICursor)mapFeatureClass.Search(null, false);

IFeatureSelection selection = (IFeatureSelection)layer;
ISelectionSet selectionSet = selection.SelectionSet;

selectionSet.Search(null, false, out cursor);
IFeature mapFeature = (cursor as IFeatureCursor).NextFeature();

while (mapFeature != null)
    if (geoLayer.Renderer is IRepresentationRenderer)
        IRepresentationClass repClass = (geoLayer.Renderer as IRepresentationRenderer).RepresentationClass;
        IRepresentation rep = repClass.GetRepresentation(mapFeature, mapContext);

        if (rep.Shape.GeometryType == esriGeometryType.esriGeometryPolygon)
            doSomeAction(rep.Shape); // <-- overrided geometry
    mapFeature = (cursor as IFeatureCursor).NextFeature();

And if geometry is not overrided but changed by representation rules (Smooth, Donut, Simplify etc), IRepresentation.Shape property returns original feature geometry. Other shapes properties (ShapeCopy, ShapeEdit) also returns original geometry.

How can I get geometry that was created by representation rule using ArcObjects.NET? Or may be there is some way in Arcpy?

  • I'm also very interested in getting representation geometry. Did you find finally a solution? Best regards – user74065 May 27 '16 at 13:12
  • Are you calling the UpdateFeature method after the shape is altered? Also, if you want it to persist you will need to call IFeature.Store – Brad Apr 16 '18 at 11:53

Your Answer

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

Browse other questions tagged or ask your own question.