MGMap.mcsToLonLat   Go to object model Go to parent topic Go to previous topic Go to next topic

Syntax

MGPoint mcsToLonLat(double x, double y)

Description

Converts the specified Mapping Coordinate System (MCS) coordinate pair to lat/lon coordinates.

The MCS for the map file is set by the map author. For more information on Mapping Coordinate Systems, refer to the Autodesk MapGuide User's Guide.

Parameters

x - MCS X coordinate to convert. y - MCS Y coordinate to convert.

Returns

MGPoint - Coordinate in longitude/latitude units.

Error Codes

none

Example

This example is designed to work with the Tutorial.mwf file that is included with Autodesk MapGuide Author. It converts a set of lat/lon points to MCS, and then uses mcsToLonLat() to convert them back again:

{    
    var map = getMap();

    // Get lat/lon and convert to MCS
    var xyPt = map.lonLatToMcs(map.getLon(), map.getLat());

    // pull out X and Y values and display in dialog
    x = xyPt.getX();
    y = xyPt.getY();
    alert( "MCS X: " + x + "\nMCS Y:" + y );

    // Convert MCS to lat/lon
    var latLonPt = map.mcsToLonLat(x, y);

    // pull out lat/lon vals and display in dialog
    lon = latLonPt.getX();
    lat = latLonPt.getY();
    alert( "Lat: " + lat + "\nLon: " + lon );
}

See Also

lonLatToMcs