AnsweredAssumed Answered

Bug? Unable to use Inverse GeographicTransformation in ProjectionTransformation

Question asked by jonh_cunrun on Jun 29, 2018
Latest reply on Jul 3, 2018 by jonh_cunrun

This is my test code for OSGB <-> WGS84 using ProjectEx():

 

// Create SR "British_National_Grid"

SpatialReference sr27700 = SpatialReferenceBuilder.CreateSpatialReference(27700);

// Create SR "GCS_WGS_1984"
SpatialReference sr4326 = SpatialReferenceBuilder.CreateSpatialReference(4326);
MapPoint mp27700 = MapPointBuilder.CreateMapPoint(400000, 100000, sr27700);
MapPoint mp4326 = MapPointBuilder.CreateMapPoint(-2.00138787, 50.79949658, sr4326);

// Create GT "OSGB_1936_To_WGS_1984_Petroleum"
GeographicTransformation gt = GeographicTransformation.Create(1314);

   // gt.IsForward==true

GeographicTransformation gti = gt.GetInverse() as GeographicTransformation;

   // gti.IsForward==false

ProjectionTransformation pt27700to4326 = ProjectionTransformation.CreateEx(sr27700, sr4326, gt);

   // pt27700to4326 Transformation.IsForward==true
ProjectionTransformation pt4326to27700 = ProjectionTransformation.CreateEx(sr4326, sr27700, gti);

   // pt4326to27700 Transformation.IsForward==true !!!
MapPoint mp27700as4326 = GeometryEngine.Instance.ProjectEx(mp27700, pt27700to4326) as MapPoint;

   // correct: -2.0013671162770108, 50.799560607190806
MapPoint mp4326as27700 = GeometryEngine.Instance.ProjectEx(mp4326, pt4326to27700) as MapPoint;

   // incorrect: 399805.88250306522, 100118.3440916813 !!!

 

The problem appears to occur at the bolded line, where the Transformation inside the ProjectionTransformation gets IsForward set to true, despite the passed in Transformation having IsForward set to false. I would expect it to be still be false at that point, unless I'm missing something.

 

The final line confirms that the Datum Transform has indeed operated incorrectly. The correct result would be close to 400000, 100000. Failing to apply the Datum Transform would result in approx 100m offset. The incorrect result has an offset about double that.

 

Bug, or have I missed something?

Outcomes