Gets the geometry stored in the SHAPE column for the Row. This property only applies to geodatabase
feature classes and shapefiles which are capable of storing vector data.
Namespace:
ESRI.ArcGISExplorer.DataAssembly: ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
C# |
---|
public Geometry Geometry { get; } |
Visual Basic (Declaration) |
---|
Public ReadOnly Property Geometry As Geometry |
Field Value
If IsSpatial is trueTruetruetrue (True in Visual Basic), returns a Geometry object which represents the shape of the feature; if IsSpatial is falseFalsefalsefalse (False in Visual Basic), returns nullNothingnullptra null reference (Nothing in Visual Basic).Remarks
This is a convenience property which avoids the need to access the SHAPE column in
the RowValueCollection by name or by index position.
Examples
The code below accesses the properties associated with a Row object, including the geometry stored in the SHAPE column.
CopyC#
//Open Montgomery file geodatabase Geodatabase gdb = new Geodatabase(@"C:\Data\Montgomery.gdb"); //Open the parcels featureclass Table parcels = gdb.OpenTable("parcels"); //Get a single parcel by property ID Row row = parcels.Search(new Filter("PROPERTY_I = 4704")).GetFirst(); //Print out some properties of the row System.Diagnostics.Debug.Print(row.HasObjectIDColumn.ToString()); //Prints "True" System.Diagnostics.Debug.Print(row.ObjectID.ToString()); //Prints "3704" System.Diagnostics.Debug.Print(row.Table.Name); //Prints "parcels" //Get the area of this parcel System.Diagnostics.Debug.Print(row.Values[parcels.Columns.AreaColumnName].ToString()); //Prints "12815.4" //Return the geometry of the parcel from the row Polygon poly = row.Geometry as Polygon; //Call ToString() on the polygon to print summary geometry information System.Diagnostics.Debug.Print(poly.ToString()); //Prints "Polygon: Point count = 7 Ring count = 1" //Get the area of this parcel from the geometry System.Diagnostics.Debug.Print(poly.Area.ToString()); //Prints "12815.4"
CopyVB.NET
'Open Montgomery file geodatabase Dim gdb As Geodatabase = New Geodatabase("C:\Data\Montgomery.gdb") 'Open the parcels featureclass Dim parcels As Table = gdb.OpenTable("parcels") 'Get a single parcel by property ID Dim r As Row = parcels.Search(New Filter("PROPERTY_I = 4704")).GetFirst() 'Print out some properties of the row System.Diagnostics.Debug.Print(r.HasObjectIDColumn.ToString()) 'Prints "True" System.Diagnostics.Debug.Print(r.ObjectID.ToString()) 'Prints "3704" System.Diagnostics.Debug.Print(r.Table.Name) 'Prints "parcels" 'Get the area of this parcel System.Diagnostics.Debug.Print(r.Values.Item(parcels.Columns.AreaColumnName).ToString()) 'Prints "12815.4" 'Return the geometry of the parcel from the row Dim poly As Polygon = r.Geometry 'Call ToString() on the polygon to print summary geometry information System.Diagnostics.Debug.Print(poly.ToString()) 'Prints "Polygon: Point count = 7 Ring count = 1" 'Get the area of this parcel from the geometry System.Diagnostics.Debug.Print(poly.Area.ToString()) 'Prints "12815.4"