How to get the GPS coordinates (longitude, latitude) of the clicked/tapped point in ArcGIS Esri map?
I tried MapViewTapped
event like:
private void myMapView_MapViewTapped(object sender, MapViewInputEventAtgs e)
{
var x = e.Position.X; //e.Location.X;
var y = e.Position.Y; //e.Location.Y;
}
Both it gives large unexpected values.
You're using the MapViewInputEventArgs.Position property - this gives screen coordinates - see the sample code for Show Mouse Coordinates. Use the Location property to get map coordinates, as also shown in the sample.
Worth noting that it's very likely that your Map is using the Web Mercator coordinate system - e.g. if you have created a MapView using the default Esri basemaps. If so, the map coordinates will be reported in Meters, approximately in the range -20,000,000 to +20,000,000.
The coordinate system WGS84 gives latitude and longitude in degrees, and is used by GPS systems. To convert a point from another coordinate system (e.g. the SpatialReference of your MapView, if different to that), you can 'project' the point - use the Project method on the GeometryEngine class, and pass in a MapPoint and the SpatialReference you want, e.g.
MapPoint projectedPoint = GeometryEngine.Project(e.Location, SpatialReferences.Wgs84);
See the Project Coordinate sample that demonstrates that.