[mapguide-users] Re: Convert mcs To LonLat in C#

Mauricio Villablanca mgvillablanca at yahoo.com
Sat Mar 6 03:33:39 EST 2010


Check the web api for the MgCoordinateSystemFactory class. Example:

function transformCoordinate($source, $target, $x, $y) {
		//converts a coordinate from the source to the target coordinate sytem, 
		
		$coordSysFactory = new MgCoordinateSystemFactory();
		$coordSys1 = $coordSysFactory->CreateFromCode($source);
		$coordSys2 = $coordSysFactory->CreateFromCode($target);
		$csTransform12 = $coordSysFactory->GetTransform($coordSys1, $coordSys2);
		$csTransform21 = $coordSysFactory->GetTransform($coordSys2, $coordSys1);
		
		$geometryFactory = new MgGeometryFactory();
		$coordinateArg = $geometryFactory->CreateCoordinateXY($x, $y);
		$coordinate12 = $csTransform12->Transform($coordinateArg);
		$x12 = $coordinate12->GetX();
		$y12 = $coordinate12->GetY();
		$new_coordinate = $geometryFactory->CreateCoordinateXY($x12, $y12);
		
		return $new_coordinate;		
	}
        
         $newLLpoint = transformCoordinate("CA83-VF", "LL84", $x1, $y1);

-- 
View this message in context: http://n2.nabble.com/Convert-mcs-To-LonLat-in-C-tp4540965p4685546.html
Sent from the MapGuide Users mailing list archive at Nabble.com.


More information about the mapguide-users mailing list