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

ToGeo function return values inconsistent #7

Closed
LEO-E-100 opened this issue Oct 18, 2018 · 1 comment
Closed

ToGeo function return values inconsistent #7

LEO-E-100 opened this issue Oct 18, 2018 · 1 comment

Comments

@LEO-E-100
Copy link

The H3 Go function h3.ToGeo(h3.Index) returns a value which is out by 360 degrees compared to the Python implementation. An example illustrates the point below.

Python functions return the following:

h3_address = h3.geo_to_h3(51.5233512, -0.0810132, 12)

center_point = h3.h3_to_geo(h3_address)

print(h3_address)
print(center_point)
'8c194ad30d067ff'
[51.523416454245556, -0.08106823052469281]

Go Lang functions return the following:

func main() {

	geo := h3.GeoCoord{
		Latitude:  51.5233512,
		Longitude: -0.0810132,
	}

	h3Address := h3.FromGeo(geo, 12)
	centerPoint := h3.ToGeo(h3_address)

	fmt.Println(h3Address)
	fmt.Println(centerPoint)
}
630948894377797631
{51.52341645424555 359.9189317694753}
Lang Longitude Val
Python -0.08106823052469281
Go 359.9189317694753

This seems inconsistent - While I understand the type of the address changes between Python(String) and GoLang(uint64) for good reasons. The value of the ToGeo functions varies by 360 exactly. This isn't a difficult fix within a system but I don't understand the inconsistency.

@jogly
Copy link
Collaborator

jogly commented Oct 18, 2018

I expect you'll find the python bindings are using a more up-to-date h3 core than the Go bindings are. Specifically, geo output constrained to [-Pi, Pi] was added in release v3.1.1 but the Go bindings are using v3.0.8 at the moment. I'm adding a badge to the README in #8 to make it more clear which h3 version is being wrapped 😄

I will create an issue to track pulling in more recent h3 core versions but I need to first address the gap this binding currently has with 3.0.* ☹️

(if you find I'm wrong feel free to re-open with the versions of each library you're using to reproduce the issue)

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

2 participants