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

Syntax

MGPoint lonLatToMcs(double lon, 
  double lat)

Description

Converts the specified lat/lon coordinate pair to a point using the Mapping Coordinate System (MCS) defined for the MWF by the map author.

Note that this method takes the longitude as its first argument and the latitude as its second agument. For more information on Mapping Coordinate Systems, refer to the Autodesk MapGuide User's Guide.

Parameters

lon - Longitude coordinate to convert. lat - Latitude coordinate to convert.

Returns

MGPoint - The coordinate in MCS units.

Error Codes

none

Example

The following example is designed to work with the Tutorial.mwf file that is included with Autodesk MapGuide Author. It converts a lat/lon coordinate pair to an MCS point and displays the x and y values of that point:

function convertToMcs() 
{    
    var map = getMap();
    var lat = map.getLat();
    var lon = map.getLon();

    // display point in lat/lon
    alert( "Lat: " + lat + "\nLon: " + lon );

    // get MCS coords and display
    var xyPt = map.lonLatToMcs(lon, lat);
    alert( "MCS X: " + xyPt.getX() + "\nMCS Y:" + xyPt.getY() );
}

See Also

mcsToLonLat