I have a raster in a UTM CRS projection for the Southern hemisphere (Northern beaches, Australia). Now when I’m plotting this data using the
hvplot.xarray with argument
geo=True the y coordinates [meters] are mapped to Northern hemisphere coordinates [lat] as
lat = 90 + (-y), whereas it should simply be
lat = -y. Which function is triggered by
geo=True that infers the coordinates from XY to lon/lat?
I’m not very familiar with hvplot yet, so I wasn’t sure if this is expected behaviour or a bug. If it’s a bug I’ll open an issue on the GH page.
Overal objective is to overlay the vector data (shoreline) on top of the raster (ndwi). I’m
ALL software version info
hvplot.version # ‘0.8.2’
holoviews.version # 1.15.3
Complete, minimal, self-contained example code that reproduces the issue
import xarray as xr import cartopy.crs as ccrs import geoviews as gv import holoviews as hv import hvplot.xarray import geoviews.tile_sources as gts import geopandas as gpd ndwi = xr.open_dataset("https://s3.eu-central-1.amazonaws.com/floris.calkoen.open.data/narrabeen_ndwi_2023-01-24T00%3A02%3A21.tif", engine="rasterio") shoreline = gpd.read_file("https://s3.eu-central-1.amazonaws.com/floris.calkoen.open.data/narrabeen_shoreline_2023-01-24T00%3A02%3A21.geojson") ndwi.rio.crs == shoreline.crs ## true utm_zone = shoreline.crs.utm_zone southern_hemisphere = True if utm_zone[-1] == "S" else False utm_code = int(utm_zone[:-1]) utm_crs = ccrs.UTM(utm_code, southern_hemisphere) # why cartopy.crs.UTM() doesn't handle utm zone strings? shoreline_plot = gv.Path([shoreline], crs=utm_crs) ndwi_plot = ndwi["band_data"].squeeze().hvplot(x="x", y="y", geo=True, crs=utm_crs) shoreline_plot * gts.EsriImagery # this seems correct ndwi_plot # see how the XY coordinates are converted from XY UTM zone 56S to latitudes in the northern hemisphere (90 + (-y)) shoreline_plot * ndwi_plot # therefore the overlay doesn't work