Converting mouse position to latitude longitude

930
2
Jump to solution
06-20-2017 11:33 AM
RobertGoodwin1
New Contributor II

I have a pretty basic question, but for whatever reason, I have not been able to find the answer.  I am porting some code based on a pretty old version of the ESRI .NET API.  We would convert coordinates with methods like ESRI.ArcGIS.Client.Bing.Transform.WebMercatorToGeographic.  I am simply trying to get the latitude and longitude of the mouse location.  Any suggestions on where to start?

Tags (2)
Reply
0 Kudos
1 Solution

Accepted Solutions
ChadYoder1
Occasional Contributor II

If you use the tap or holding event on the map, it would be something like:

//Get the map point in WGS84
var holdPt = new MapPoint (e.Location.X, e.Location.Y, EsriMapView.SpatialReference);
var mapPt = (MapPoint)GeometryEngine.Project (holdPt, SpatialReferences.Wgs84);

View solution in original post

Reply
0 Kudos
2 Replies
ChadYoder1
Occasional Contributor II

If you use the tap or holding event on the map, it would be something like:

//Get the map point in WGS84
var holdPt = new MapPoint (e.Location.X, e.Location.Y, EsriMapView.SpatialReference);
var mapPt = (MapPoint)GeometryEngine.Project (holdPt, SpatialReferences.Wgs84);

View solution in original post

Reply
0 Kudos
RobertGoodwin1
New Contributor II

Wow, I had something almost identical, and I am still unsure as to why the results I was getting were incorrect, but what you have works for me.  Thanks so much.

Reply
0 Kudos