-
Notifications
You must be signed in to change notification settings - Fork 18
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
Feature request: Support non-standard CRS in mapping functions #50
Comments
s-m-t-c
changed the title
Support non-standard CRS in mapping functions
Feature request: Support non-standard CRS in mapping functions
Jun 7, 2022
So, if you have (x1, y1), _, (x2, y2) = gbox.extent.exterior.to_crs("epsg:4326").points[:3]
bounds = [[y1, x1], [y2, x2]] |
@s-m-t-c this below works: import numpy as np
from ipyleaflet import Map, basemaps, ImageOverlay, projections
import rioxarray as rio
import odc.geo.xr
# wget https://masie_web.apps.nsidc.org/pub//DATASETS/NOAA/G02135/south/monthly/geotiff/08_Aug/S_201908_concentration_v3.0.tif
path = 'S_201908_concentration_v3.0.tif'
yy = rio.open_rasterio(path).isel(band=0)
# 1. bring to CRS of the map
xx = yy.odc.reproject("epsg:3031")
display(xx.odc.geobox)
# 2. Convert to RGB and compress into data url
vmin, vmax = np.nanpercentile(xx.data, [2, 98])
rgba = xx.odc.colorize(vmin=vmin, vmax=vmax)
rgba.plot.imshow(aspect=1, size=4);
data_url = rgba.odc.compress(as_data_url=True)
# 3. TL and BR corner coordinates projected to LatLon makes bounds
(x1, y1), _, (x2, y2) = rgba.odc.geobox.extent.exterior.to_crs("epsg:4326").points[:3]
bounds = [[y1, x1], [y2, x2]]
# 4. Make map and display
m = Map(basemap=basemaps.NASAGIBS.BlueMarble3031, center=(-90, 0), zoom=1, crs=projections.EPSG3031)
m.add_layer(ImageOverlay(url=data_url, bounds=bounds, opacity=0.7))
display(m) so coordinates of top-left and bottom-right corners in lat/lon order is what |
This was solved by #54, should work in |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I would like to plot EPSG:3031 data using something like
data.odc.add_to(map)
.I have been experimenting with solutions using something like below which currently does not work.
Others have encountered similar issues jupyter-widgets/ipyleaflet#550 though without the same projection requirements.
For an example input we can use a sea ice concentration image
The text was updated successfully, but these errors were encountered: