Ticket #143 (closed defect: fixed)

Opened 5 years ago

Last modified 5 years ago

Transforming Coordinates from MgPoint

Reported by: JimO Owned by:
Priority: medium Milestone: 1.2
Component: General Version: 1.2.0
Severity: major Keywords:
Cc: External ID: 938892

Description

I am able to transform coordinates on the fly from a FeatureReader?, but not from an MgPoint?. The MgPoint?->Transform() returns the coordinate as rads and must be converted like this:

$x = $x / M_PI * 180.0;// M_PI is the PHP constant for pi $y = $y / M_PI * 180.0;

This transform into rads works from BC Albers to LL84, but does not work at all the other way.

The featurereader code that works goes:

while ($featureReader->ReadNext?()) {

// MgByteReader? * GetGeometry? (CREFSTRING propertyName)=0 // Gets the Geometry for the specified property. $byteReader = $featureReader->GetGeometry?('GEOMETRY'); // MgGeometry? * Read (MgByteReader? *agf) // Translates an MgByteReader? object into an MgGeometry? object. $geometry = $agfReaderWriter->Read($byteReader); $geometry = $geometry->Transform($transform);

The MgPoint? code that works only one way and returns a coordinate as rads goes:

// MgCoordinate? * CreateCoordinateXY (double x, double y) // Creates an MgCoordinate? object with Dimension = XY $coord = $geometryFactory->CreateCoordinateXY((double) $_REQUESTx?, (double) $_REQUESTy?); // MgPoint? * CreatePoint? (MgCoordinate? *coordinate) // Creates a point from a coordinate. $point = $geometryFactory->CreatePoint?($coord); // MgPoint? is a subclass of MgGeometry? $point = $point->Transform($transform);

Change History

Changed 5 years ago by anonymous

  • status changed from new to closed
  • resolution set to fixed

Fixed by changes made for  http://trac.osgeo.org/mapguide/ticket/141.

Modifications to the SWIG generated wrapper code also affects the MgCoordinateSystemTransform::Transform() method which called is from MgPoint::Transform().

Changed 5 years ago by rexszeto

  • version set to 1.2.0
  • external_id set to 938892
  • milestone set to 1.2
Note: See TracTickets for help on using tickets.