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

Unable to convert cell Id to lat lng #448

Open
akkharolia opened this issue Mar 4, 2025 · 4 comments
Open

Unable to convert cell Id to lat lng #448

akkharolia opened this issue Mar 4, 2025 · 4 comments

Comments

@akkharolia
Copy link

akkharolia commented Mar 4, 2025

cell_id = 600090378170794000

the above cell is converted using h3-js successfully, in python it gives invalid cell ID error.
I tried with all function of h3-py i.e. api functions(basic_int, basic_str etc).

also found that python hex output is different from javascript output. So created below function to match the output.

def _hex(num):
rounded = int(float(num))
return hex(rounded)[2:].lower()

I'm using below function to convert to lat lng.
h3.cell_to_latlng

Still getting error of invalid cell ID.

Another Cell ID: 601803032887296000

h3-py version: 4.2.1

@dfellis
Copy link
Collaborator

dfellis commented Mar 4, 2025

Image

Can you share the code that generated the cell_id above? That is not a valid ID.

@akkharolia
Copy link
Author

I am receiving this as H3CellId in starlink telemetry API streaming data.

@dfellis
Copy link
Collaborator

dfellis commented Mar 5, 2025

It has been a while since I looked into Starlink, but as I recall, they don't use H3, but their own hex grid with a different ID system. If h3-js somehow parsed that ID you linked, that's a bug in h3-js, not in h3-py.

Even if I convert 600090378170794000 to hexadecimal, resulting in 853F30500000010 I can tell that it's invalid because there are too many digits and the ID doesn't end with trailing fs for unused resolutions.

@akkharolia
Copy link
Author

Yes, that's my concern too. Passing the string in h3toGeo in h3-js gives lat,lng of the cell. Let me look for solutions for this in starlink docs.

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