Converted a xy coordinate to lat/long using Pro SDK

123
1
09-12-2018 11:56 AM
Highlighted
New Contributor II

Have anyone converted a xy coordinate to lat/long using Pro SDK?  I just could not get the correct numbers.

0 Kudos
1 Reply
Highlighted
Regular Contributor

Hi Fayu,

 You can use this code snippet: 

return QueuedTask.Run(() => {
  var activeMapView = MapView.Active;
  MapPoint zoomToPnt = MapPointBuilder.CreateMapPoint(coord.Longitude, coord.Latitude, SpatialReferences.WGS84);
  var projectedXY = GeometryEngine.Instance.Project (zoomToPnt, activeMapView.Map.SpatialReference) as MapPoint;
});‍‍‍‍‍‍‍‍‍‍

There are multiple samples among the community samples that use projection, just search for "Instance.Project" on the community samples GitHub repo for a list of usages.