Skip to content

Latitude & Longitude order confusing #113

@ketourneau

Description

@ketourneau

Hi,

We try to convert WGS84 coordinate in WGS84 EPSG:3395 but we got wrong result.

double latitude = 47.27064771;
double longitude = -1.6129427;
string wktWGS84_3395 = "PROJCS[\"WGS84 / WorldMercator\",GEOGCS[\"WGS84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4326\"]],PROJECTION[\"Mercator_1SP\"],PARAMETER[\"central_meridian\",0],PARAMETER[\"scale_factor\",1],PARAMETER[\"false_easting\",0],PARAMETER[\"false_northing\",0],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"Easting\",EAST],AXIS[\"Northing\",NORTH],AUTHORITY[\"EPSG\",\"3395\"]]";

ProjNet.CoordinateSystems.CoordinateSystem wgs84_4326 = ProjNet.CoordinateSystems.GeographicCoordinateSystem.WGS84;
ProjNet.CoordinateSystems.CoordinateSystem wgs84_33385 = ProjNet.IO.CoordinateSystems.CoordinateSystemWktReader.Parse (wktWGS84_3395) as ProjNet.CoordinateSystems.CoordinateSystem;
ICoordinateTransformation trans = new CoordinateTransformationFactory ().CreateFromCoordinateSystems (wgs84_4326, wgs84_33385);
double[] result = trans.MathTransform.Transform (new double[] {latitude, longitude});

Debug.Log (result[0]); // Longitude: -178373.847780952
Debug.Log (result[1]); // Latitude: 5262144.43254542

Expected result :
Longitude: -179551.96870091045 Latitude: 5954960.960474437

Like documentation say :
All transformations are done on double arrays, where the first value is primary axis (X/East/Latitude) and the second the secondary (Y/North/Longitude). You can provide an optional third value (Z/Height), which can change if a datum transformation occurs* during the transform.

If we invert latitude and longitude it's work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions