Skip to content
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

overlay shapefile on raster based on raster extent #754

Open
AminFazlKazemi opened this issue Jan 29, 2022 · 0 comments
Open

overlay shapefile on raster based on raster extent #754

AminFazlKazemi opened this issue Jan 29, 2022 · 0 comments

Comments

@AminFazlKazemi
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant