Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong parameters in towgs84 for EPSG:3021 (RT90, Sweden) #190

Open
tvartom opened this issue Nov 9, 2022 · 3 comments
Open

Wrong parameters in towgs84 for EPSG:3021 (RT90, Sweden) #190

tvartom opened this issue Nov 9, 2022 · 3 comments

Comments

@tvartom
Copy link

tvartom commented Nov 9, 2022

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

@AliFlux
Copy link

AliFlux commented Nov 10, 2022

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.

@tvartom
Copy link
Author

tvartom commented Nov 10, 2022

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

@HansBM
Copy link

HansBM commented May 27, 2024

Can confirm that we also have trouble with the EPSG:3021 and using the corrected parameters gives us the correct result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants