overlay shapefile on raster based on raster extent
AminFazlKazemi opened this issue · 0 comments
AminFazlKazemi commented
Hi
I want to plot a global covering shapefile over a raster whose extent is not global. In fact I want just zoom to raster extent,
How can I do that
I used
data = rioxarray.open_rasterio(raster_address, masked=True)
Creating the plot extent object
data_plot_extent = plotting_extent(data[0],data.rio.transform())
data.xshape.overlay(shapefile_address,encoding='latin1')
boundary = (gpd.read_file(shp_address)).to_crs(es.crs_check(address))
fig,ax = plt.subplots()
da.sel(band=1).plot.contourf()
boundary.boundary.plot(ax=ax,extent=data_plot_extent,color="black")
but it didn't work
I would be very thankfull if you help