﻿ Project Method (GeometryEngine)—ArcGIS Pro
ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Core.Geometry Namespace / GeometryEngine Class / Project Method
The geometry to be projected. If the input geometry is empty, then an empty geometry with the output spatial reference is returned.
The spatial reference to which the geometry will be projected.
Example

In This Topic
Project Method (GeometryEngine)
In This Topic
Projects the given geometry to a new spatial reference. Same as GeometryEngine.ProjectEx(geometry, ProjectionTransformation.Create(geometry.SpatialReference, outputSpatialReference)); or, if both spatial references have vertical coordinate systems same as GeometryEngine.ProjectEx(geometry, ProjectionTransformation.CreateWithVertical(geometry.SpatialReference, outputSpatialReference));
Syntax
```public Geometry Project(
Geometry geometry,
SpatialReference outputSpatialReference
)```
```Public Function Project( _
ByVal geometry As Geometry, _
ByVal outputSpatialReference As SpatialReference _
) As Geometry```

#### Parameters

geometry
The geometry to be projected. If the input geometry is empty, then an empty geometry with the output spatial reference is returned.
outputSpatialReference
The spatial reference to which the geometry will be projected.

#### Return Value

The projected geometry.
Exceptions
ExceptionDescription
Geometry is null.
The method is not implemented for GeometryBag.
geometry.SpatialReference or output spatial reference is null.
geometry.SpatialReference or output spatial reference is unknown coordinate system.
Example
Determine grid convergence for a SpatialReference at a given point
```Coordinate2D coordinate = new Coordinate2D(10, 30);
double angle = SpatialReferences.WGS84.GetConvergenceAngle(coordinate);
// angle = 0

SpatialReference srUTM30N = SpatialReferenceBuilder.CreateSpatialReference(32630);
coordinate.X = 500000;
coordinate.Y = 550000;
angle = srUTM30N.GetConvergenceAngle(coordinate);
// angle = 0

MapPoint pointWGS84 = MapPointBuilderEx.CreateMapPoint(10, 50, SpatialReferences.WGS84);
MapPoint pointUTM30N = GeometryEngine.Instance.Project(
pointWGS84, srUTM30N) as MapPoint;

coordinate = (Coordinate2D)pointUTM30N;
// get convergence angle and convert to degrees
angle = srUTM30N.GetConvergenceAngle(coordinate) * 180 / Math.PI;
// angle = 10.03
```
Zoom to a specified point
```//Create a point
var pt = MapPointBuilderEx.CreateMapPoint(x, y,
SpatialReferenceBuilder.CreateSpatialReference(4326));
//Buffer it - for purpose of zoom
var poly = GeometryEngine.Instance.Buffer(pt, buffer_size);

//do we need to project the buffer polygon?
if (!MapView.Active.Map.SpatialReference.IsEqual(poly.SpatialReference))
{
//project the polygon
poly = GeometryEngine.Instance.Project(poly, MapView.Active.Map.SpatialReference);
}

// Must run on MCT.
{
//Zoom - add in a delay for animation effect
MapView.Active.ZoomTo(poly, new TimeSpan(0, 0, 0, 3));
});
```
Project from WGS84 to WebMercator
```MapPoint pt = MapPointBuilderEx.CreateMapPoint(1.0, 3.0, SpatialReferences.WGS84);
Geometry result = GeometryEngine.Instance.Project(pt, SpatialReferences.WebMercator);
MapPoint projectedPt = result as MapPoint;```
Project from WGS84
```// create the polygon
List<MapPoint> pts = new List<MapPoint>();

Polygon polygon = PolygonBuilderEx.CreatePolygon(pts);
// ensure it is simple
bool isSimple = GeometryEngine.Instance.IsSimpleAsFeature(polygon);

// create the spatial reference to project to
SpatialReference northPole = SpatialReferenceBuilder.CreateSpatialReference(102018);   // north pole stereographic

// project
Geometry geometry = GeometryEngine.Instance.Project(polygon, northPole);```
Use Select or Search with a Spatial Query
```//var featSceneLayer = ...;
//var sname = featSceneLayer.Name;
{
if (!featSceneLayer.HasAssociatedFeatureService)
return;//no search or select

//Select all features within the current map view
var sz = MapView.Active.GetViewSize();
var map_pt1 = MapView.Active.ClientToMap(new System.Windows.Point(0, sz.Height));
var map_pt2 = MapView.Active.ClientToMap(new System.Windows.Point(sz.Width, 0));

//Convert to an envelope
var temp_env = EnvelopeBuilderEx.CreateEnvelope(map_pt1, map_pt2, MapView.Active.Map.SpatialReference);

//Project if needed to the layer spatial ref
SpatialReference sr = null;
using (var fc = featSceneLayer.GetFeatureClass())
using (var fdef = fc.GetDefinition())
sr = fdef.GetSpatialReference();

var env = GeometryEngine.Instance.Project(temp_env, sr) as Envelope;

//Set up a query filter
var sf = new SpatialQueryFilter()
{
FilterGeometry = env,
SpatialRelationship = SpatialRelationship.Intersects,
SubFields = "*"
};

//Select against the feature service
var select = featSceneLayer.Select(sf);
if (select.GetCount() > 0)
{
//enumerate over the selected features
using (var rc = select.Search())
{
while (rc.MoveNext())
{
using (var feature = rc.Current as Feature)
{
var oid = feature.GetObjectID();
//etc.
}
}
}
}

MapView.Active.Map.ClearSelection();

});```
Requirements

Target Platforms: Windows 11, Windows 10

ArcGIS Pro version: 3 or higher.