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

v2: EPSG:4326 to EPSG:2157 inconsistency with proj with negative latitude #11

Open
davidjb opened this issue Nov 18, 2024 · 0 comments
Open

Comments

@davidjb
Copy link

davidjb commented Nov 18, 2024

Many thanks for creating this library. I've tried the following transform between EPSG:4326 and EPSG:2157 and the calculations appear fine when inside the bounds of EPSG:2157. However, when outside the bounds and latitude becomes negative, there are in inconsistencies between wgs84 and other tools like proj. Testing something like Null Island (0,0) is fine and consistent, but once latitude is negative, results differ:

package main

import (
	"fmt"

	"github.com/wroge/wgs84/v2"
)

func main() {
	transform := wgs84.Transform(wgs84.EPSG(4326), wgs84.EPSG(2157)).Round(3)

	// Consistent
	east, north, h := transform(0, 0, 0)
	fmt.Printf("%.3f\t%.3f %.3f\n", east, north, h)

	// go run main.go
	// 1493322.696     -5179198.412 0.000
	// echo 0 0 | cs2cs +init=epsg:4326 +to +init=epsg:2157 -d 3
	// 1493322.696     -5179198.412 0.000
	// https://epsg.io/transform#s_srs=4326&t_srs=2157&x=0&y=-0
	// 1493322.696462611 -5179198.412407922

	// Inconsistent - negative lat
	east, north, h = transform(100, -1, 0)
	fmt.Printf("%.3f\t%.3f %.3f\n", east, north, h)

	// go run main.go
	// 12431088.352    -5548823.633 0.000
	// echo 100 -10 | cs2cs +init=epsg:4326 +to +init=epsg:2157 -d 3
	// 12431089.926    -24809902.916 0.000
	// https://epsg.io/transform#s_srs=4326&t_srs=2157&x=100.0000000&y=-10.0000000
	// 12431089.925768612 -24809902.916357957
}

Tested with the current commit on v2 at 5fb8989. Let me know if you need any more info.

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

No branches or pull requests

1 participant