ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Core.Geometry Namespace / Geometry Class
Members Example

In This Topic
    Geometry Class
    In This Topic
    An abstract base class for objects that define geometric shapes. Geometry objects can be used as geometry definitions for rendering data.
    Object Model
    Geometry ClassGeometry ClassEnvelope ClassSpatialReference Class
    Syntax
    public abstract class Geometry 
    Public MustInherit Class Geometry 
    Example
    Retrieve Geometry from Geodatabase
    // methods need to run on the MCT
    ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
    {
      try
      {
        // open a gdb
        using (ArcGIS.Core.Data.Geodatabase gdb = 
                  new ArcGIS.Core.Data.Geodatabase(
                      new FileGeodatabaseConnectionPath(new Uri(@"c:\Temp\MyDatabase.gdb"))))
        {
          //Open a featureClass 
          using (ArcGIS.Core.Data.FeatureClass featureClass = 
                         gdb.OpenDataset<ArcGIS.Core.Data.FeatureClass>("Polygon"))
          {
            
            ArcGIS.Core.Data.QueryFilter filter = 
                       new ArcGIS.Core.Data.QueryFilter()
                        {
                          WhereClause = "OBJECTID = 6"
                        };
    
            // get the row
            using (ArcGIS.Core.Data.RowCursor rowCursor = 
                                   featureClass.Search(filter, false))
            {
              while (rowCursor.MoveNext())
              {
                using (var row = rowCursor.Current)
                {
                  long oid = row.GetObjectID();
    
                  // get the shape from the row
                  ArcGIS.Core.Data.Feature feature = row as ArcGIS.Core.Data.Feature;
                  Polygon polygon = feature.GetShape() as Polygon;
    
                  // do something here
                }
              }
            }
          }
        }
      }
      catch (Exception ex)
      {
        // error - handle appropriately
      }
    });
    
    Inheritance Hierarchy
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also