-
Notifications
You must be signed in to change notification settings - Fork 85
Description
Never heard of this project but https://claude.ai/ used it in a response.
I have a data set of EPSG:28992 points. The reponse used ProjNet to convert these to WGS 84. It boils down to the following code:
var rdNew = csFactory.CreateFromWkt(
"PROJCS[\"Amersfoort / RD New\",GEOGCS[\"Amersfoort\",DATUM[\"Amersfoort\",SPHEROID[\"Bessel 1841\",6377397.155,299.1528128,AUTHORITY[\"EPSG\",\"7004\"]],AUTHORITY[\"EPSG\",\"6289\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.01745329251994328,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4289\"]],PROJECTION[\"Oblique_Stereographic\"],PARAMETER[\"latitude_of_origin\",52.15616055555555],PARAMETER[\"central_meridian\",5.38763888888889],PARAMETER[\"scale_factor\",0.9999079],PARAMETER[\"false_easting\",155000],PARAMETER[\"false_northing\",463000],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AUTHORITY[\"EPSG\",\"28992\"]]");
var wgs84 = csFactory.CreateFromWkt(
"GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.01745329251994328,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4326\"]]");
var ctFactory = new CoordinateTransformationFactory();
_rdNewToWgs84 = ctFactory.CreateFromCoordinateSystems(rdNew, wgs84);I don't know what is wrong with it but it cause the lat/lng coordinates to be roughly 150 meters offset.
Interestingly the solution assumed Postgis and manually modifying it to use ST_Transform(geom, 4326) resulted in correct lat/lng coordinates.
I asked it to reflect on what could be causing the offset and Claude.ai replied with:
PostGIS handles this correctly because it includes the proper transformation grid file (nl_nsgi_rdcorr2018.gsb) and datum shift parameters, while our ProjNet implementation was doing a simpler, less accurate transformation.
It provided a fix (modify the CoordinateTransformer to include these parameters) but stated:
However, even with these parameters, you might still see small differences compared to PostGIS because PostGIS uses a more sophisticated grid-based transformation that accounts for local variations in the datum shift across the Netherlands.
Sharing this here because this wasted several hours of diagnosing an incorrect AI response and I assumed that conversion to be correct because it was a package.