-
Notifications
You must be signed in to change notification settings - Fork 21
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
DataArrays that aren't in lat-lon co-ordinates: are they supported? #52
Comments
From this code: |
From what I can see from looking at that bit of code, and playing with the library, it seems that code only deals with a map that is in a different projection, not a DataArray that's in a different projection. Looking at https://github.com/davidbrochart/xarray_leaflet/blob/main/xarray_leaflet/xarray_leaflet.py#L340, it seems that the raw lat-lon values of the tile boundaries are used to index the DataArray (and the same again at https://github.com/davidbrochart/xarray_leaflet/blob/main/xarray_leaflet/xarray_leaflet.py#L367) - and obviously this won't work if the xarray is indexed in lat-lon. The reprojection that happens later (https://github.com/davidbrochart/xarray_leaflet/blob/main/xarray_leaflet/xarray_leaflet.py#L387) seems to be reprojecting to the projection of the map object. I think this might be fixable relatively easily, if we can reproject to WGS84 before we do the subsetting - I'll do some experimenting and let you know how I get on. |
hey @robintw, if you don't mind building off an unmerged PR in ipyleaflet, it's not too difficult to use imageservice layers with rioxarray. I found that it was easier when I was tinkering around on a project to just dynamically create images versus trying to do dynamically create projected tiles. Probably would be better in the long run to get the tiles working but this wasn't too bad 🤷 |
I'm trying to use xarray_leaflet to display an image that I've loaded via rioxarray. The image isn't in WGS84 projection (it's in a UK-based projection). It doesn't appear on the map, so I've been looking into the code.
In
_get_tiles()
the DataArray seems to be indexed by the lat/lon co-ordinates of a mercantile tile.Does this mean that xarray_leaflet does not currently support working with DataArrays that are not indexed in lat/lon co-ordinates? I notice that the examples use large-scale global datasets that seem to be in WGS84.
The text was updated successfully, but these errors were encountered: