Quantcast
Channel: MapWinGIS ActiveX Map and GIS Component
Viewing all articles
Browse latest Browse all 2341

New Post: Latitude and Longitude

$
0
0
Hi, here is a code sample. You can format the resulting coordinates in whatever way you like. Please see more on map projection and coordinates here.
private void Init()
{
    axMap1.SendMouseMove = true;
    axMap1.MouseMoveEvent += axMap1_MouseMoveEvent;     // "plus=" operator to attach an event handler
}

void axMap1_MouseMoveEvent(object sender, AxMapWinGIS._DMapEvents_MouseMoveEvent e)
{
    if (axMap1.Measuring.IsUsingEllipsoid)
    {
        // if map projection is set and there is known conversion to decimal degrees
        double degX = 0.0, degY = 0.0;
        axMap1.PixelToDegrees(e.x, e.y, ref degX, ref degY);
    }
    else
    {
        double projX = 0.0, projY = 0.0;
        axMap1.PixelToProj(e.x, e.y, ref projX, ref projY);
    }
}
Hope it helps,
Sergei

Viewing all articles
Browse latest Browse all 2341

Trending Articles