| MGMap.lonLatToMcs |
|
MGPoint lonLatToMcs(double lon, double lat)
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.
lon - Longitude coordinate to convert. lat - Latitude coordinate to convert.
MGPoint - The coordinate in MCS units.
none
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() );
}