Click or drag to resize

GeometryEngineProject Method (Geometry, SpatialReference)

Projects the given geometry from its current spatial reference system into the given spatial reference system.

Namespace:  Esri.ArcGISRuntime.Geometry
Assembly:  Esri.ArcGISRuntime (in Esri.ArcGISRuntime.dll) Version: 100.9.0
public static Geometry Project(
	Geometry geometry,
	SpatialReference outputSpatialReference


Type: Esri.ArcGISRuntime.GeometryGeometry
The geometry to be projected.
Type: Esri.ArcGISRuntime.GeometrySpatialReference
The spatial reference to which geometry need to be projected.

Return Value

Type: Geometry
The geometry projected into the given SpatialReference. If the input geometry has a null SpatialReference, no projection occurs; instead, an identical geometry with the given SpatialReference is returned.

A default best-choice DatumTransformation is applied to the project operation. To control the specific transformation used, use the Project(Geometry, SpatialReference, DatumTransformation) overload.

If the geometry parameter has z-values, those z-values will also be transformed, if both the SpatialReference of that geometry, and the outputSpatialReference parameter, have a vertical coordinate system.



Example Name: Project

Project a point from one spatial reference to another.

Code example screen shot.

// Copyright 2019 Esri.
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
// You may obtain a copy of the License at:
// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
// language governing permissions and limitations under the License.

using Esri.ArcGISRuntime.Geometry;
using Esri.ArcGISRuntime.Mapping;
using Esri.ArcGISRuntime.Symbology;
using Esri.ArcGISRuntime.UI;
using Esri.ArcGISRuntime.UI.Controls;
using Color = System.Drawing.Color;

namespace ArcGISRuntime.WPF.Samples.Project
        name: "Project",
        category: "Geometry",
        description: "Project a point from one spatial reference to another.",
        instructions: "Click anywhere on the map. A callout will display the clicked location's coordinate in the original (basemap's) spatial reference and in the projected spatial reference.",
        tags: new[] { "WGS 84", "Web Mercator", "coordinate system", "coordinates", "latitude", "longitude", "projected", "projection", "spatial reference" })]
    public partial class Project
        public Project()

        private async void Initialize()
            // Show a map in the default WebMercator spatial reference.
            MyMapView.Map = new Map(Basemap.CreateNationalGeographic());

            // Add a graphics overlay for showing the tapped point.
            GraphicsOverlay overlay = new GraphicsOverlay();
            SimpleMarkerSymbol markerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle.Circle, Color.Red, 5);
            overlay.Renderer = new SimpleRenderer(markerSymbol);

            // Respond to user taps.
            MyMapView.GeoViewTapped += MapView_Tapped;

            // Zoom to Minneapolis.
            Envelope startingEnvelope = new Envelope(-10995912.335747, 5267868.874421, -9880363.974046, 5960699.183877,
            await MyMapView.SetViewpointGeometryAsync(startingEnvelope);

        private void MapView_Tapped(object sender, GeoViewInputEventArgs e)
            // Get the tapped point - this is in the map's spatial reference,
            // which in this case is WebMercator because that is the SR used by the included basemaps.
            MapPoint tappedPoint = e.Location;

            // Update the graphics.
            MyMapView.GraphicsOverlays[0].Graphics.Add(new Graphic(tappedPoint));

            // Project the point to WGS84
            MapPoint projectedPoint = (MapPoint) GeometryEngine.Project(tappedPoint, SpatialReferences.Wgs84);

            // Format the results in strings.
            string originalCoords = string.Format("Original: {0:F4}, {1:F4}", tappedPoint.X, tappedPoint.Y);
            string projectedCoords = string.Format("Projected: {0:F4}, {1:F4}", projectedPoint.X, projectedPoint.Y);
            string formattedString = string.Format("{0}\n{1}", originalCoords, projectedCoords);

            // Define a callout and show it in the map view.
            CalloutDefinition calloutDef = new CalloutDefinition("Coordinates:", formattedString);
            MyMapView.ShowCalloutAt(tappedPoint, calloutDef);
<UserControl x:Class="ArcGISRuntime.WPF.Samples.Project.Project"
        <esri:MapView x:Name="MyMapView" />
See Also
Additional Examples
Hyperlink to ExampleDescription
AuthorMapCreate and save a map as an ArcGIS `PortalItem` (i.e. web map).
BufferListGenerate multiple individual buffers or a single unioned buffer around multiple points.
CreateAndSaveKmlFileConstruct a KML document and save it as a KMZ file.
GeodesicOperationsCalculate a geodesic path between two points and measure its distance.
ProjectProject a point from one spatial reference to another.
ProjectWithSpecificTransformationProject a point from one coordinate system to another using a specific transformation step.
SceneLayerSelectionIdentify features in a scene to select.
SceneLayerUrlDisplay an ArcGIS scene layer from a URL.
ShowCalloutShow a callout with the latitude and longitude of user-tapped points.