I'm trying to use rioxarray.open_rasterio to create an xarray dataarray from a COG and then use hvplot to visualize it, which takes a Cartopy crs argument.
This is a bit embarrassing but I can't figure out how to obtain a crs proj or epsg code from rioxarray.open_rasterio.
If I use xarray.open_rasterio I have .crs, which gives me the proj or epsg code, but with rioxarray.open_rasterio I see spatial_ref, which contains wkt.
Example:
# from https://openaerialmap.org/
cog_url = (
"https://oin-hotosm.s3.amazonaws.com/"
"5d7dad0becaf880008a9bc88/0/5d7dad0becaf880008a9bc89.tif"
)
import xarray as xr
xr.open_rasterio(cog_url).crs
yields:
But rioxarray:
import rioxarray as rx
rioxarray.open_rasterio(cog_url).spatial_ref
yields:
<xarray.DataArray 'spatial_ref' ()>
array(0)
Coordinates:
spatial_ref int64 0
Attributes:
spatial_ref: PROJCS["WGS 84 / Pseudo-Mercator",GEOGCS["WGS 84",DATUM["WG...
crs_wkt: PROJCS["WGS 84 / Pseudo-Mercator",GEOGCS["WGS 84",DATUM["WG...
I think I'm definitely missing something here. 😕
I'm trying to use
rioxarray.open_rasterioto create an xarray dataarray from a COG and then usehvplotto visualize it, which takes a Cartopy crs argument.This is a bit embarrassing but I can't figure out how to obtain a crs proj or epsg code from
rioxarray.open_rasterio.If I use
xarray.open_rasterioI have.crs, which gives me the proj or epsg code, but withrioxarray.open_rasterioI seespatial_ref, which containswkt.Example:
yields:
But rioxarray:
yields:
I think I'm definitely missing something here. 😕