Incorrect Transformation to WGS84 for Non-EPSG Definitions – Bug in the Persistable Reference Parser
The OSDU Conversion API fails to correctly transform to WGS84 when encountering non-EPSG definitions. The issue arises when the API has to parse the persistable reference for custom transformations instead of using EPSG codes for lookup. The problem exist both for v3 and v4 of the API.
This can be demonstrated by defining a bound CRS tied to an EPSG-defined transformation using a persistable reference string and changing the authority from EPSG
to TEST
. This action forces the API to parse the persistable reference string since the authority is no longer EPSG.
Like for instance:
Operation: ED50 (EPSG:4230) to WGS84 (EPSG:4326) by using the 1612 transformation
Changing the authority for the transformation from EPSG
to TEST
in the persistable reference string
To obtain correct results, the CRS order must be changed in the transformation WKT, in addition to inverting the sign of the transformation parameters. Therefore, there is likely an issue with the ordering logic when parsing the transformation WKT in the persistable reference.
Examples Table of Contents
- Example 1: EPSG:4230 to EPSG:4326 via EPSG:1612
- Example 2: EPSG:4221 to EPSG:4326 via EPSG:1127
- Example 3: EPSG:4267 to EPSG:4326 via EPSG:1170
- Example 4: EPSG:4230 to EPSG:32632 via EPSG:1612
Example 1: EPSG:4230 to EPSG:4326 via EPSG:1612
{
"fromCRS": "{\"authCode\":{\"auth\":\"OSDU\",\"code\":\"4230023\"},\"lateBoundCRS\":{\"authCode\":{\"auth\":\"EPSG\",\"code\":\"4230\"},\"name\":\"GCS_European_1950\",\"type\":\"LBC\",\"ver\":\"PE_10_9_1\",\"wkt\":\"GEOGCS[\\\"GCS_European_1950\\\",DATUM[\\\"D_European_1950\\\",SPHEROID[\\\"International_1924\\\",6378388.0,297.0]],PRIMEM[\\\"Greenwich\\\",0.0],UNIT[\\\"Degree\\\",0.0174532925199433],AUTHORITY[\\\"EPSG\\\",4230]]\"},\"name\":\"ED50 * EPSG-Nor N62 2001 [4230,1612]\",\"singleCT\":{\"authCode\":{\"auth\":\"TEST\",\"code\":\"1612\"},\"name\":\"ED_1950_To_WGS_1984_23\",\"type\":\"ST\",\"ver\":\"PE_10_9_1\",\"wkt\":\"GEOGTRAN[\\\"ED_1950_To_WGS_1984_23\\\",GEOGCS[\\\"GCS_European_1950\\\",DATUM[\\\"D_European_1950\\\",SPHEROID[\\\"International_1924\\\",6378388.0,297.0]],PRIMEM[\\\"Greenwich\\\",0.0],UNIT[\\\"Degree\\\",0.0174532925199433]],GEOGCS[\\\"GCS_WGS_1984\\\",DATUM[\\\"D_WGS_1984\\\",SPHEROID[\\\"WGS_1984\\\",6378137.0,298.257223563]],PRIMEM[\\\"Greenwich\\\",0.0],UNIT[\\\"Degree\\\",0.0174532925199433]],METHOD[\\\"Position_Vector\\\"],PARAMETER[\\\"X_Axis_Translation\\\",-116.641],PARAMETER[\\\"Y_Axis_Translation\\\",-56.931],PARAMETER[\\\"Z_Axis_Translation\\\",-110.559],PARAMETER[\\\"X_Axis_Rotation\\\",0.893],PARAMETER[\\\"Y_Axis_Rotation\\\",0.921],PARAMETER[\\\"Z_Axis_Rotation\\\",-0.917],PARAMETER[\\\"Scale_Difference\\\",-3.52],OPERATIONACCURACY[1.0],AUTHORITY[\\\"EPSG\\\",1612]]\"},\"type\":\"EBC\",\"ver\":\"PE_10_9_1\"}",
"toCRS": "opendes:reference-data--CoordinateReferenceSystem:Geographic2D:EPSG::4326:",
"points": [
{
"x": 10.00000000,
"y": 63.00000000
}
]
}
Should get:
x: 9.99847571
y: 62.99967496
Example 2: EPSG:4221 to EPSG:4326 via EPSG:1127
{
"fromCRS": "{\"authCode\":{\"auth\":\"OSDU\",\"code\":\"4221001\"},\"lateBoundCRS\":{\"authCode\":{\"auth\":\"EPSG\",\"code\":\"4221\"},\"name\":\"GCS_Campo_Inchauspe\",\"type\":\"LBC\",\"ver\":\"PE_10_9_1\",\"wkt\":\"GEOGCS[\\\"GCS_Campo_Inchauspe\\\",DATUM[\\\"D_Campo_Inchauspe\\\",SPHEROID[\\\"International_1924\\\",6378388.0,297.0]],PRIMEM[\\\"Greenwich\\\",0.0],UNIT[\\\"Degree\\\",0.0174532925199433],AUTHORITY[\\\"EPSG\\\",4221]]\"},\"name\":\"Campo Inchauspe * DMA-Arg [4221,1127]\",\"singleCT\":{\"authCode\":{\"auth\":\"TEST\",\"code\":\"1127\"},\"name\":\"Campo_Inchauspe_To_WGS_1984\",\"type\":\"ST\",\"ver\":\"PE_10_9_1\",\"wkt\":\"GEOGTRAN[\\\"Campo_Inchauspe_To_WGS_1984\\\",GEOGCS[\\\"GCS_Campo_Inchauspe\\\",DATUM[\\\"D_Campo_Inchauspe\\\",SPHEROID[\\\"International_1924\\\",6378388.0,297.0]],PRIMEM[\\\"Greenwich\\\",0.0],UNIT[\\\"Degree\\\",0.0174532925199433]],GEOGCS[\\\"GCS_WGS_1984\\\",DATUM[\\\"D_WGS_1984\\\",SPHEROID[\\\"WGS_1984\\\",6378137.0,298.257223563]],PRIMEM[\\\"Greenwich\\\",0.0],UNIT[\\\"Degree\\\",0.0174532925199433]],METHOD[\\\"Geocentric_Translation\\\"],PARAMETER[\\\"X_Axis_Translation\\\",-148.0],PARAMETER[\\\"Y_Axis_Translation\\\",136.0],PARAMETER[\\\"Z_Axis_Translation\\\",90.0],OPERATIONACCURACY[9.0],AUTHORITY[\\\"EPSG\\\",1127]]\"},\"type\":\"EBC\",\"ver\":\"PE_10_9_1\"}",
"toCRS": "opendes:reference-data--CoordinateReferenceSystem:Geographic2D:EPSG::4326:",
"points": [
{
"x": -70.00000000,
"y": -30.00000000
}
]
}
Should get:
x: -70.00095929
y: -29.99938902
Example 3: EPSG:4267 to EPSG:4326 via EPSG:1170
{
"fromCRS": "{\"authCode\":{\"auth\":\"OSDU\",\"code\":\"4267001\"},\"lateBoundCRS\":{\"authCode\":{\"auth\":\"EPSG\",\"code\":\"4267\"},\"name\":\"GCS_North_American_1927\",\"type\":\"LBC\",\"ver\":\"PE_10_9_1\",\"wkt\":\"GEOGCS[\\\"GCS_North_American_1927\\\",DATUM[\\\"D_North_American_1927\\\",SPHEROID[\\\"Clarke_1866\\\",6378206.4,294.9786982]],PRIMEM[\\\"Greenwich\\\",0.0],UNIT[\\\"Degree\\\",0.0174532925199433],AUTHORITY[\\\"EPSG\\\",4267]]\"},\"name\":\"NAD27 * DMA-Carib [4267,1170]\",\"singleCT\":{\"authCode\":{\"auth\":\"TEST\",\"code\":\"1170\"},\"name\":\"NAD_1927_To_WGS_1984_1\",\"type\":\"ST\",\"ver\":\"PE_10_9_1\",\"wkt\":\"GEOGTRAN[\\\"NAD_1927_To_WGS_1984_1\\\",GEOGCS[\\\"GCS_North_American_1927\\\",DATUM[\\\"D_North_American_1927\\\",SPHEROID[\\\"Clarke_1866\\\",6378206.4,294.9786982]],PRIMEM[\\\"Greenwich\\\",0.0],UNIT[\\\"Degree\\\",0.0174532925199433]],GEOGCS[\\\"GCS_WGS_1984\\\",DATUM[\\\"D_WGS_1984\\\",SPHEROID[\\\"WGS_1984\\\",6378137.0,298.257223563]],PRIMEM[\\\"Greenwich\\\",0.0],UNIT[\\\"Degree\\\",0.0174532925199433]],METHOD[\\\"Geocentric_Translation\\\"],PARAMETER[\\\"X_Axis_Translation\\\",-3.0],PARAMETER[\\\"Y_Axis_Translation\\\",142.0],PARAMETER[\\\"Z_Axis_Translation\\\",183.0],OPERATIONACCURACY[16.0],AUTHORITY[\\\"EPSG\\\",1170]]\"},\"type\":\"EBC\",\"ver\":\"PE_10_9_1\"}",
"toCRS": "opendes:reference-data--CoordinateReferenceSystem:Geographic2D:EPSG::4326:",
"points": [
{
"x": -65.00000000,
"y": 20.00000000
}
]
}
Should get:
x: -64.99945251
y: 20.00057704
Example 4: EPSG:4230 to EPSG:32632 via EPSG:1612
{
"fromCRS": "{\"authCode\":{\"auth\":\"OSDU\",\"code\":\"4230023\"},\"lateBoundCRS\":{\"authCode\":{\"auth\":\"EPSG\",\"code\":\"4230\"},\"name\":\"GCS_European_1950\",\"type\":\"LBC\",\"ver\":\"PE_10_9_1\",\"wkt\":\"GEOGCS[\\\"GCS_European_1950\\\",DATUM[\\\"D_European_1950\\\",SPHEROID[\\\"International_1924\\\",6378388.0,297.0]],PRIMEM[\\\"Greenwich\\\",0.0],UNIT[\\\"Degree\\\",0.0174532925199433],AUTHORITY[\\\"EPSG\\\",4230]]\"},\"name\":\"ED50 * EPSG-Nor N62 2001 [4230,1612]\",\"singleCT\":{\"authCode\":{\"auth\":\"TEST\",\"code\":\"1612\"},\"name\":\"ED_1950_To_WGS_1984_23\",\"type\":\"ST\",\"ver\":\"PE_10_9_1\",\"wkt\":\"GEOGTRAN[\\\"ED_1950_To_WGS_1984_23\\\",GEOGCS[\\\"GCS_European_1950\\\",DATUM[\\\"D_European_1950\\\",SPHEROID[\\\"International_1924\\\",6378388.0,297.0]],PRIMEM[\\\"Greenwich\\\",0.0],UNIT[\\\"Degree\\\",0.0174532925199433]],GEOGCS[\\\"GCS_WGS_1984\\\",DATUM[\\\"D_WGS_1984\\\",SPHEROID[\\\"WGS_1984\\\",6378137.0,298.257223563]],PRIMEM[\\\"Greenwich\\\",0.0],UNIT[\\\"Degree\\\",0.0174532925199433]],METHOD[\\\"Position_Vector\\\"],PARAMETER[\\\"X_Axis_Translation\\\",-116.641],PARAMETER[\\\"Y_Axis_Translation\\\",-56.931],PARAMETER[\\\"Z_Axis_Translation\\\",-110.559],PARAMETER[\\\"X_Axis_Rotation\\\",0.893],PARAMETER[\\\"Y_Axis_Rotation\\\",0.921],PARAMETER[\\\"Z_Axis_Rotation\\\",-0.917],PARAMETER[\\\"Scale_Difference\\\",-3.52],OPERATIONACCURACY[1.0],AUTHORITY[\\\"EPSG\\\",1612]]\"},\"type\":\"EBC\",\"ver\":\"PE_10_9_1\"}",
"toCRS": "opendes:reference-data--CoordinateReferenceSystem:Projected:EPSG::32632:",
"points": [
{
"x": 10.00000000,
"y": 63.00000000
}
]
}
Should get:
x: 550574.404
y: 6985945.655