Web API Reference | MapGuide Open Source

- Overview
- Modules
- Classes

GetLastTransformStatus
GetSource
GetTarget
IgnoreDatumShiftWarning
IgnoreOutsideDomainWarning
IsIgnoreDatumShiftWarning
IsIgnoreOutsideDomainWarning
IsValidSourcePoint
IsValidSourcePoint
IsValidTargetPoint
IsValidTargetPoint
ResetLastTransformStatus
SetSourceAndTarget
Transform
Transform
Transform
Transform
TransformCoordinate
TransformDatumShiftWarning
TransformM
TransformM
TransformOk
TransformOutsideDomainWarning
TransformTotalFailure
virtual MgEnvelope* MgCoordinateSystemTransform::Transform | ( | MgEnvelope * | envelope | ) | `[pure virtual]`
Transforms an MgEnvelope instance for the source coordinate system into an MgEnvelope instance for target coordinate system. .NET Syntax
`virtual MgEnvelope Transform(MgEnvelope envelope);`
Java Syntax
`virtual MgEnvelope Transform(MgEnvelope envelope);`
PHP Syntax
`virtual MgEnvelope Transform(MgEnvelope envelope);`
  Parameters:
  | envelope | (MgEnvelope) An MgEnvelope object obtained from the MgCoordinateSystemMeasure for the source coordinate system.
Returns: Returns an MgEnvelope object for the target coordinate system.. Example (PHP) The result of executing this code is that $env1 is the same as $env21 and $env2 is the same as $env12.
     $coordSys1 = $coordSysFactory->Create($wkt1);
     $coordSys2 = $coordSysFactory->Create($wkt2);
     $csTransform12 = new MgCoordinateSystemTransform($coordSys1, $coordSys2);
     $csTransform21 = new MgCoordinateSystemTransform($coordSys2, $coordSys1);
     $coordSysMeasure1 = new MgCoordinateSystemMeasure($coordSys1);
     $coordSysMeasure2 = new MgCoordinateSystemMeasure($coordSys2);
     $env1 = $coordSysMeasure1->GetEnvelope();
     $env2 = $coordSysMeasure2->GetEnvelope();
     $env12 = $csTransform12->Transform($env1);
     $env21 = $csTransform21->Transform($env2);
Example (C#) This code creates a geography coordinate system envelope that is approximately 30 km on the diagonal and transforms that envelope into its equivalent in a projected coordinate system.
     using OSGeo.MapGuide;
     private MgCoordinateSystemTransform coordSysTransformGeogToProj;
     private MgCoordinateSystemTransform coordSysTransformProjToGeog;
     private double geogCSX = -160.101421317;
     private double geogCSY = 22.0234263273;
     private MgEnvelope geogCSEnv;
     private MgEnvelope projCSEnv;
     private double urX = geogCSX + 0.2;
     private double urY = geogCSY + 0.2;
     double expectedProjLLX = 386323.976322775;
     double expectedProjLLY = 2435694.36972722;
     double expectedProjURX = 407098.230068439;
     double expectedProjURY = 2457970.15998103;
     double tolerance = 0.001;
     Boolean lowerLeftIsEquivalent;
     Boolean upperRightIsEquivalent;

     geogCSEnv = new MgEnvelope(geogCSX, geogCSY, urX, urY);
     projCSEnv = coordSysTransformGeogToProj.Transform(geogCSEnv);
     lowerLeftIsEquivalent = Math.Abs(expectedProjLLX - projCSEnv.GetLowerLeftCoordinate().GetX()) < tolerance && Math.Abs(expectedProjLLY - projCSEnv.GetLowerLeftCoordinate().GetY()) < tolerance;
     upperRightIsEquivalent = Math.Abs(expectedProjURX - projCSEnv.GetUpperRightCoordinate().GetX()) < tolerance && Math.Abs(expectedProjURY - projCSEnv.GetUpperRightCoordinate().GetY()) < tolerance;
  Exceptions:
  | MgCoordinateSystemTransformFailedException |
Implements MgTransform.

Comments or suggestions? Send us feedback.