Using the OpenStreet map example, how can I determine the geodetic location of a user click? It seems that I should be able to use the UnProjectFromMap method to convert from Cartesian coordinates, but I'm unsure how to obtain the Cartesian coordinate of the click in the maps internal coordinate system. The MapMouseLeftDown event, for example, provides a Point that corresponds to the ViewPort coordinate.
Thanks in advance!
you can use this code to get the geodetic coordinate of the point that was clicked on:
private void XamWebMap_MapMouseLeftButtonDown(object sender, MapMouseButtonEventArgs e) { XamWebMap theMap = (XamWebMap)sender; Point mousePosition = e.Position; Point mapPosition = theMap.Viewport.RootCanvas.RenderTransform.Inverse.Transform(mousePosition); Point geoPosition = theMap.MapProjection.UnprojectFromMap(mapPosition);
}
Works perfectly! Many thanks!