| MGMap.mcsToLonLat |
|
MGPoint mcsToLonLat(double x, double y)
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.
x - MCS X coordinate to convert. y - MCS Y coordinate to convert.
MGPoint - Coordinate in longitude/latitude units.
none
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 );
}