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

Evaluate if xddgs healpix code can be ported to javascript #98

Open
yellowcap opened this issue Oct 24, 2024 · 6 comments
Open

Evaluate if xddgs healpix code can be ported to javascript #98

yellowcap opened this issue Oct 24, 2024 · 6 comments
Assignees

Comments

@yellowcap
Copy link
Collaborator

The xarray-xddgs library has python functions to create polygons based on heaplix cell ids.

If we can port this to javascript we could do healpix visualizations in js applications.

From a quick look, it seems like xddgs relies on heaply for the caclulations, which in turn is bundles the HEALPix C++ library. So porting to javascript might not be simple because the heavy lift of the healpix calculations happens in C at the moment.

@tinaok
Copy link
Collaborator

tinaok commented Oct 24, 2024

Hi @yellowcap Thats a great idia
Here is the main version of xdggs https://github.com/xarray-contrib/xdggs/blob/main/xdggs/healpix.py
I link to @keewis and @jmdelouis
I also link to this issue xarray-contrib/xdggs#11

@yellowcap
Copy link
Collaborator Author

Any pointers of how to go from Healpix ID to polygon would be quite helpful.

I was also wondering if there are some pre-computed layers with healpix geometries in a shapfile/geojson type format, because the grids themselves are static and could be pre-computed.

@keewis
Copy link

keewis commented Nov 4, 2024

Any pointers of how to go from Healpix ID to polygon would be quite helpful.

xdggs provides a cell_boundaries method that returns shapely polygons (or as geoarrow, but I don't remember whether I actually exposed that switch)

I was also wondering if there are some pre-computed layers with healpix geometries in a shapfile/geojson type format

not that I'm aware of, but this should be pretty easy to create (I'd write to geoparquet, though, that's usually much faster to read than text-based formats).

@yellowcap
Copy link
Collaborator Author

Thanks @keewis great idea to just generate the necessary layers directly!

xdggs provides a cell_boundaries method that returns shapely polygons

I have seen this, but if I got it correctly, this is ultimatively being computed in C++, so to understand the actual contruction of the geometry and porting to Javascript, we will probably have to digg into the C code.

Probably its faster to pre-generate the levels that we want to use.

@keewis
Copy link

keewis commented Nov 6, 2024

you could also use a rust library (cdshealpix?), compile that to WASM and call it from javascript?

@yellowcap
Copy link
Collaborator Author

Thanks @keewis good idea. @danielfdsilva something to evaluate on the Javascript side?

@yellowcap yellowcap self-assigned this Dec 9, 2024
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

3 participants