I am using Google Map with MapUnit as Meter. I want to get the latitude and longitude of the location with MouseMove event of the WinformsMap. I am able to retrieve world coordinate from screen coordinates but now want latitude and longitude.
There is a project GPS to Google Map (Desktop) in the Code Community, that does almost that. It shows how to plot on the Google Map a point in Longitude/Latitude. You can use the same projection parameters for getting Long/Lat at mouse mouve event.
I want to pass the screen coordinate of a point and find latitude/longitude of the selected point in the Google Map. In the project GPS to Google Map (Desktop) in the Code Community the latitude and longitude values are passed and respective point is ploted in the map.
See following code snippet, hope it is what we are trying to get from ScreenPoint(e) to world coordinate(pointShape).
private void winformsMap1_MouseMove(object sender, MouseEventArgs e) { //Displays the X and Y in screen coordinates. statusStrip1.Items["toolStripStatusLabelScreen"].Text = "X:" + e.X + " Y:" + e.Y;
//Gets the PointShape in world coordinates from screen coordinates. PointShape pointShape = ExtentHelper.ToWorldCoordinate(winformsMap1.CurrentExtent, new ScreenPointF(e.X, e.Y), winformsMap1.Width, winformsMap1.Height);
private void winformsMap1_MouseMove(object sender, MouseEventArgs e) { //Displays the X and Y in screen coordinates. statusStrip1.Items["toolStripStatusLabelScreen"].Text = "X:" + e.X + " Y:" + e.Y;
//Gets the PointShape in world coordinates from screen coordinates. PointShape pointShape = ExtentHelper.ToWorldCoordinate(winformsMap1.CurrentExtent, new ScreenPointF(e.X, e.Y), winformsMap1.Width, winformsMap1.Height);