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

Get crs and transform from xarray rio accessor in array_to_memory_file #679

Merged
merged 2 commits into from
Feb 13, 2024

Conversation

lopezvoliver
Copy link
Collaborator

This PR makes array_to_memory_file check if the array has a rio accessor, and retrieve crs and transform from it.

This makes it possible to use add_raster with an xarray.DataArray without having to provide the source keyword argument using array_args.

This is demonstrated in the updated 89_image_array_viz.ipynb notebook:

m.add_raster(masked_array, colormap="coolwarm", layer_name="Classified DEM")

(No need for the image = leafmap.array_to_image(masked_array, source=dem) step)

@giswqs
Copy link
Member

giswqs commented Feb 13, 2024

Great improvement! Thank you.

@giswqs giswqs merged commit 2442b1f into opengeos:master Feb 13, 2024
12 checks passed
@lopezvoliver lopezvoliver deleted the rio branch February 26, 2024 05:57
sthagen pushed a commit to sthagen/giswqs-leafmap that referenced this pull request Jul 10, 2024
kuzja111 pushed a commit to kuzja111/leafmap that referenced this pull request Jul 25, 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

Successfully merging this pull request may close these issues.

2 participants