IGeometry Interface

Provides access to members that describe properties and behavior of all geometric objects.

Description

Common properties and methods shared by all geometric objects. Geometries are objects that define a spatial location and an associated geometric shape.

Members

Name Description
Read-only property Dimension The topological dimension of this geometry.
Read-only property Envelope Creates a copy of this geometry's envelope and returns it.
Read-only property GeometryType The type of this geometry.
Method GeoNormalize Shifts longitudes, if need be, into a continuous range of 360 degrees.
Method GeoNormalizeFromLongitude Normalizes longitudes into a continuous range containing the longitude. This method is obsolete.
Read-only property IsEmpty Indicates whether this geometry contains any points.
Method Project Projects this geometry into a new spatial reference.
Method QueryEnvelope Copies this geometry's envelope properties into the specified envelope.
Method SetEmpty Removes all points from this geometry.
Method SnapToSpatialReference Moves points of this geometry so that they can be represented in the precision of the geometry's associated spatial reference system.
Read/write property SpatialReference The spatial reference associated with this geometry.

IGeometry.Dimension Property

The topological dimension of this geometry.

Public ReadOnly Property Dimension As esriGeometryDimension
public esriGeometryDimension Dimension {get;}

Description

Returns the dimension of the geometry object based on the geometry's type.

Remarks

Note: At 9.0, Multipatches are now considered as two dimensional geometry. esriGeometry3Dimensionwill be used for an upcoming new geometry type.

Supported esriGeometryDimensions:-1 esriGeometryNoDimension1 esriGeometry0Dimension2 esriGeometry1Dimension4 esriGeometry2Dimension5 esriGeometry25Dimension6 esriGeometry3DimensionDimension Example

IGeometry.Envelope Property

Creates a copy of this geometry's envelope and returns it.

Public ReadOnly Property Envelope As IEnvelope
public IEnvelope Envelope {get;}

Description

Returns the unique Envelope that binds the Geometry object. This is the smallest Envelope that Contains the object.

Remarks

Envelope Example

IGeometry.GeometryType Property

The type of this geometry.

Public ReadOnly Property GeometryType As esriGeometryType
public esriGeometryType GeometryType {get;}

Remarks

esriGeometryNull          = 0esriGeometryPoint         = 1esriGeometryMultipoint    = 2esriGeometryPolyline      = 3esriGeometryPolygon       = 4esriGeometryEnvelope      = 5esriGeometryPath          = 6esriGeometryAny           = 7esriGeometryMultiPatch    = 9esriGeometryRing          = 11esriGeometryLine          = 13esriGeometryCircularArc   = 14esriGeometryBezier3Curve  = 15esriGeometryEllipticArc   = 16esriGeometryBag           = 17esriGeometryTriangleStrip = 18esriGeometryTriangleFan   = 19esriGeometryRay           = 20esriGeometrySphere        = 21

Geometry Type Example

IGeometry.GeoNormalize Method

Shifts longitudes, if need be, into a continuous range of 360 degrees.

Public Sub GeoNormalize ( _
)
public void GeoNormalize (
);

Remarks

GeoNormalize acts on geometries whose geographic system coordinates are below -180 degrees longitude or over +180 degrees longitude or on geometries that span the +-180 degrees longitude.

This method requires the geometry to have a valid spatial reference (geographic or projected coordinate system).

This method is used internally as part of the projection process for polygons and polylines. It is typically not used by itself.

IGeometry.GeoNormalizeFromLongitude Method

Normalizes longitudes into a continuous range containing the longitude. This method is obsolete.

Public Sub GeoNormalizeFromLongitude ( _
    ByVal Longitude As Double _
)
public void GeoNormalizeFromLongitude (
    double Longitude
);

Remarks

This method is obsolete. Use IGeometry::GeoNormalize instead.

This method requires the geometry to have a valid spatial reference (geographic or projected coordinate system).

IGeometry.IsEmpty Property

Indicates whether this geometry contains any points.

Public ReadOnly Property IsEmpty As Boolean
public bool IsEmpty {get;}

Description

IsEmpty returns TRUE when the Geometry object does not contain geometric information beyond its original initialization state. An object may be returned to its original initialization (IsEmpty = TRUE) state using SetEmpty.

IGeometry.Project Method

Projects this geometry into a new spatial reference.

Public Sub Project ( _
    ByVal newReferenceSystem As ISpatialReference _
)
public void Project (
    ISpatialReference newReferenceSystem
);

Description

To Project, the geometry needs to have a Spatial Referenceset, and not have an UnknownCoordinateSystem. The new spatial reference system passed to the method defines the output coordinate system. If either spatial reference is Unknown, the coordinates are not changed. The Z and measure values are not changed by the Project method.

A geometry is not densified before it is projected. This can lead to the output geometries not reflecting the 'true' shape in the new coordinate system. A straight line in one coordinate system is not necessarily a straight line in a different coordinate system. Use IGeometry2::ProjectEx if you want to densify the geometries while they are projected.

The Project method must be applied on high-level geometries only. High-Level geometries are point, multipoint, polyline and polygon. To use this method with low-level geometries such as segments (Line, Circular Arc, Elliptic Arc, B�zier Curve), paths or rings, they must be wrapped into high-level geometry types.

If a geometry is projected to a projected coordinate system that can't represent the geographic area where the geometry is located (or if trying to move an xy coordinate from outside the projected coordinate system back into geographic), the geometry will be set to empty.

Remarks

Note: This method can only be called upon the top level geometries (Points, Multipoints, Polylines and Polygons). If the from/to spatial references have different geographic coordinate systems, the Project method looks for a GeoTransformationsOperationSet. If the set of Geotransformations is present in memory, Project will use it to perform a geographic/datum Transformation. To use a specific geotransformation, use the IGeometry2::ProjectEx method.

//Create Spatial Reference Factory

            ISpatialReferenceFactory srFactory = new SpatialReferenceEnvironmentClass();

            ISpatialReference sr1;

            //GCS to project from

            IGeographicCoordinateSystem gcs = srFactory.CreateGeographicCoordinateSystem((int)esriSRGeoCSType.esriSRGeoCS_NAD1983);

            sr1 = gcs;

            sr1.SetFalseOriginAndUnits(-180, -90, 1000000);

            //Projected Coordinate System to project into

            IProjectedCoordinateSystem pcs = srFactory.CreateProjectedCoordinateSystem((int)esriSRProjCSType.esriSRProjCS_NAD1983N_AmericaLambert);

            pcs.SetFalseOriginAndUnits(0, 0, 1000);

            ISpatialReference sr2;

            sr2 = pcs;

            //Point to project

            IPoint point = new PointClass() as IPoint;

            point.PutCoords(-117.17, 34.06);

            //Geometry Interface to do actual project

            IGeometry geometry;

            geometry = point;

            geometry.SpatialReference = sr1;

            geometry.Project(sr2);

            point = geometry as IPoint;

            double x;

            double y;

            point.QueryCoords(out x, out y);

            Debug.Print("X: " + x.ToString());

Debug.Print("Y: " + y.ToString());

IGeometry.QueryEnvelope Method

Copies this geometry's envelope properties into the specified envelope.

Public Sub QueryEnvelope ( _
    ByVal outEnvelope As IEnvelope _
)
public void QueryEnvelope (
    IEnvelope outEnvelope
);

Description

Returns the unique Envelope that binds the Geometry object. This is the smallest Envelope that Contains the object.

Remarks

Note: The output geometry must be co-created prior to the query. The output geometry is not co-created by the method; it is populated. This can be used in performance critical situations. For example, creating the geometry only once outside a loop and use the query method could improve performance.

QueryEnvelope Example

IGeometry.SetEmpty Method

Removes all points from this geometry.

Public Sub SetEmpty ( _
)
public void SetEmpty (
);

Description

SetEmpty returns the Geometry to its original initialization state by releasing all data referenced by the Geometry.

Remarks

Use the SetEmpty method to clear geometries and release memory. For example, a polygon with 100 rings will have an internal array of 100 pointers to ring objects. That array will go away and Release will be called on each ring. If that polygon had the only reference on those rings, then they'll go away, which releases all their segments, which may also then go away.

private bool EmptyGeometry(IGeometry geometry)

    {

        geometry.SetEmpty();

        return geometry.IsEmpty;

    }

IGeometry.SnapToSpatialReference Method

Moves points of this geometry so that they can be represented in the precision of the geometry's associated spatial reference system.

Public Sub SnapToSpatialReference ( _
)
public void SnapToSpatialReference (
);

Remarks

SnapToSpatialReference rounds all coordinates to the resolution defined by the geometry's spatial reference system. This has a similar effect on the geometry as storing the geometry in a Geodatabase.

IGeometry.SpatialReference Property

The spatial reference associated with this geometry.

Public Property SpatialReference As ISpatialReference
public ISpatialReference SpatialReference {get; set;}

Description

Returns and sets the Spatial Reference in which the geometry exists. If the spatial reference has not been set the property will return an empty ISpatialReference instance.

Classes that implement IGeometry

Classes Description
BezierCurve A cubic Bezier curve defined between two points; optionally has measure, height and ID attributes at each endpoint.
CircularArc A portion of a circle that connects two points optionally has measure, height and ID attributes at each endpoint.
EllipticArc A portion of the boundary of a 2D ellipse that connects two points; optionally has measure, height and ID attributes at each endpoint.
Envelope A rectangle with sides parallel to a coordinate system defining the extent of another geometry; optionally has min and max measure, height and ID attributes.
GeometryBag An ordered collection of objects that support the IGeometry interface.
Line A 2D straight line between a pair of 2D endpoints; can optionally have height, measure and ID attributes at each endpoint.
MultiPatch A collection of surface patches.
Multipoint An ordered collection of points; optionally has measure, height and ID attributes.
Path A sequence of connected segments.
Point A two dimensional point, optionally with measure, height, and ID attributes.
Polygon A collection of rings ordered by their containment relationship; optionally has measure, height and ID attributes.
Polyline An ordered collection of paths; optionally has measure, height and ID attributes.
Ray A 3D ray that begins at a point and extends infinitely along a line in one direction only.
Ring An area bounded by one, closed sequence of connected segments; optionally has measure, height and ID attributes at each vertex.
Sphere A complete sphere.
TriangleFan A continuous 3D fan of triangles, where each triangle after the first shares an edge with the preceding triangle, and all triangles share a common pivot point.
Triangles A collection of 3D triangles, where each consecutive triplet of vertices defines a new triangle
TriangleStrip A continuous 3D strip of triangles, where each triangle after the first shares an edge with the preceding triangle.

Remarks

Every Geometry created within ArcGIS should be assigned a spatial reference. Always attach well-defined spatial references to new geometries. This improves processing efficiency, in particular, when using ITopologicalOperator on geometries that contain curved segments (circular arcs, bezier curves, elliptical arcs).New geometries include any geometry that is created in memory. It does not matter whether it will be stored in a feature class or not. Well-defined as applied to a spatial reference means that it not only has its coordinate system (projection) defined, but also its coordinate grid. The coordinate grid consists of the xy domain, xy resolution, and xy cluster tolerance properties of a spatial reference. If the Geometry includes z or m values, the z or m domains, z or m resolutions, and z or m cluster tolerance properties must also be defined. The cluster tolerance and resolutions can be quickly and easily set using SetDefault methods on ISpatialReferenceResolution and ISpatialReferenceTolerance interfaces.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.