Opened 17 years ago

Closed 17 years ago

Last modified 17 years ago

#143 closed defect (fixed)

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 (2)

comment:1 by anonymous, 17 years ago

Resolution: fixed
Status: newclosed

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().

comment:2 by rexszeto, 17 years ago

External ID: 938892
Milestone: 1.2
Version: 1.2.0
Note: See TracTickets for help on using tickets.