Open tvartom opened 2 years ago
Hi.
Can you please share a snippet about how you are using this proj4 to transform the coordinates?
I think the issue is with the always_xy
parameter of Proj. In newer versions the axis orientation can be flipped.
Thanks for looking into ths.
I'm using proj4js and the proj4js-definition from https://epsg.io/3021.js.
According to http://proj4js.org/#:~:text=4326%27))%3B-,Axis%20order,-By%20default%2C%20proj4
the default is always [x=longitude,y=latitude]
.
My code is only using this order in the code, and not setting the enforceAxis.
(Note that the presentation of RT90 coordinates is a bit confusing with X,Y where X=Northing and Y=Easting)
npm install proj4
import proj4 from "proj4";
// Defs from https://epsg.io/3021.js
proj4.defs("EPSG:3021","+proj=tmerc +lat_0=0 +lon_0=15.8082777777778 +k=1 +x_0=1500000 +y_0=0 +ellps=bessel +towgs84=414.1,41.3,603.1,0.855,-2.141,7.023,0 +units=m +no_defs +type=crs");
const [ew, ns] = [1654936, 6404561]; //Lummelunda Cave, Gotland in EPSG:3021 (RT90)
const [lon, lat] = proj4("EPSG:3021", "EPSG:4326", [ew, ns]);
console.log([lon,lat]); // prints: [ 18.41059513866261, 57.74033121915699 ] 265 meters off
// Should be: [ 18.40681206572018, 57.73905641421247 ]
Using proj4js version 2.8.0
Can confirm that we also have trouble with the EPSG:3021 and using the corrected parameters gives us the correct result.
Thanks for a great site!
There seems to be a problem with EPSG:3021.
https://epsg.io/3021 gives:
+towgs84=414.1,41.3,603.1,0.855,-2.141,7.023,0
When using this definition (With Proj4JS), the transformed coordinates is about 100m off.The correct parameters seems to be:
+towgs84=414.1,41.3,603.1,-0.855,2.141,-7.023,0
Note the reverted signs for the last three parameters.
Also see this forum-post: https://gis.stackexchange.com/questions/444703/is-proj4js-definition-for-epsg3021-rt90-wrong-on-https-epsg-io-3021