ProjNet4GeoAPI
ProjNet4GeoAPI copied to clipboard
Projection with NAD83 is not the same as ESRI
I need to preface this by saying I am not an expert in the GIS domain. But I have been using ESRI.ArgGISRuntime in the past and the results returned by the NetTopologySuite are not the same as the ones returned by ESRI. Now, either I don't use the code properly or there is a bug.
The output is quite different. Is there a reason for this? Am I using either library incorrectly?
If I try to transform the following point: 47.4073238, -120.5757999 from this WKT
WKT
GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
ESRI
var srFrom = new SpatialReference("GEOGCS[\"GCS_North_American_1983\",DATUM[\"D_North_American_1983\",SPHEROID[\"GRS_1980\",6378137,298.257222101]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.017453292519943295]]");
var srGPS = new SpatialReference(4326);
var newMapPoint = GeometryEngine.Project(new MapPoint(-120.5757999, 47.4073238, srFrom), srGPS) as MapPoint;
Console.WriteLine($"{newMapPoint.X} {newMapPoint.Y} {newMapPoint.Z}");
// Output: -120.575814456652 47.4073295963295 0
ProjNet4GeoAPI
var ctFac = new CoordinateTransformationFactory();
ICoordinateSystemFactory csFac = new ProjNet.CoordinateSystems.CoordinateSystemFactory();
ICoordinateSystem csSource = csFac.CreateFromWkt("GEOGCS[\"GCS_North_American_1983\",DATUM[\"D_North_American_1983\",SPHEROID[\"GRS_1980\",6378137,298.257222101]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.017453292519943295]]");
ICoordinateSystem csTarget = GeographicCoordinateSystem.WGS84;
var transform = ctFac.CreateFromCoordinateSystems(csSource, GeographicCoordinateSystem.WGS84);
var result = transform.MathTransform.Transform(new double[] { -120.5757999, 47.4073238 });
Console.WriteLine($"{result[0]} {result[1]} {result[2]}");
// Output: -120.5757999 47.4073238405132 0.00495647825300694
I am using ProjNET4GeoAPI 1.4.1