Provides access to members that extend the IGeometry interface with a more sophisticated projection method.
Members
Name | Description | |
---|---|---|
Dimension | The topological dimension of this geometry. | |
Envelope | Creates a copy of this geometry's envelope and returns it. | |
GeometryType | The type of this geometry. | |
GeoNormalize | Shifts longitudes, if need be, into a continuous range of 360 degrees. | |
GeoNormalizeFromLongitude | Normalizes longitudes into a continuous range containing the longitude. This method is obsolete. | |
IsEmpty | Indicates whether this geometry contains any points. | |
Project | Projects this geometry into a new spatial reference. | |
ProjectEx | Projects a geometry, optionally applies a GeoTransformation, and optionally densifies the geometry. | |
QueryEnvelope | Copies this geometry's envelope properties into the specified envelope. | |
SetEmpty | Removes all points from this geometry. | |
SnapToSpatialReference | Moves points of this geometry so that they can be represented in the precision of the geometry's associated spatial reference system. | |
SpatialReference | The spatial reference associated with this geometry. |
IGeometry2.ProjectEx Method
Projects a geometry, optionally applies a GeoTransformation, and optionally densifies the geometry.
Public Sub ProjectEx ( _
ByVal newReferenceSystem As ISpatialReference, _
ByVal Direction As esriTransformDirection, _
ByVal GeoTransformation As IGeoTransformation, _
ByVal bAngularDensify As Boolean, _
ByVal maxSegmentLength As Double, _
ByVal maxDeviation As Double _
)
public void ProjectEx (
ISpatialReference newReferenceSystem,
esriTransformDirection Direction,
IGeoTransformation GeoTransformation,
bool bAngularDensify,
double maxSegmentLength,
double maxDeviation
);
Errors Returned
Run-time Error: 430 Class does not support Automation or does not support expected interface
This error will be produced when IGeometry2::ProjectEx is used on a GeometryBag which contains segments: BezierCurve, CircularArc, EllipticArc, Line. Segments do not implement IGeometry2. To avoid this restriction convert the segment into a Polyline before adding it to the GeometryBag.
Remarks
By default, ProjectEx will not densify geometries as they are 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. Set the bAngularDensify parameter__if you want to densify the geometries while they are projected.
//This example demonstrates how to use IGeometry2::ProjectEx
public void ProjectExExample()
{
//Create source spatial reference
ISpatialReferenceFactory spatialReferenceFactory = new SpatialReferenceEnvironmentClass();
ISpatialReference spatialReference = spatialReferenceFactory.CreateGeographicCoordinateSystem((int)esriSRGeoCSType.esriSRGeoCS_WGS1984);
spatialReference.SetFalseOriginAndUnits(-80.0000000232831, 39.9999999767169, 42949672.9);
//Create envelope and define its spatial reference
IEnvelope envelope = new EnvelopeClass();
envelope.PutCoords(-68.6076204314651, 49.6186709634653, -68.5531907607304, 49.6530789785679);
envelope.SpatialReference = spatialReference;
//Destination spatial reference
IProjectedCoordinateSystem projectedCoordinateSystem = spatialReferenceFactory.CreateProjectedCoordinateSystem((int)esriSRProjCSType.esriSRProjCS_NAD1927UTM_19N);
//Define the XYDomain equivalent to SetFalseOriginAndUnits
projectedCoordinateSystem.SetDomain(500000, 600000, 5300000, 5600000);
//Create a Geotransformation (Datum transformation)
IGeoTransformation geoTransformation = spatialReferenceFactory.CreateGeoTransformation((int)esriSRGeoTransformationType.esriSRGeoTransformation_NAD1927_To_WGS1984_12) as IGeoTransformation;
String report = "Print envelope coordinates before projection:\n" +
envelope.XMin + " , " + envelope.YMin + " , " + envelope.XMax + " , " + envelope.YMax + "\n\n\n";
//Project envelope
IGeometry2 geometry = envelope as IGeometry2;
geometry.ProjectEx(projectedCoordinateSystem as ISpatialReference, esriTransformDirection.esriTransformReverse, geoTransformation, false, 0, 0);
report = report + "Print envelope coordinates after projection:\n" +
envelope.XMin + " , " + envelope.YMin + " , " + envelope.XMax + " , " + envelope.YMax;
System.Windows.Forms.MessageBox.Show(report);
}
Inherited Interfaces
Interfaces | Description |
---|---|
IGeometry | Provides access to members that describe properties and behavior of all geometric objects. |
Classes that implement IGeometry2
Classes | Description |
---|---|
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. |
MultiPatch | A collection of surface patches. |
Multipoint | An ordered collection of points; optionally has measure, height and ID attributes. |
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. |
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. |