I have a bunch of polygons which I loaded from a shapefile into a fields
GeoDataFrame:
geometry raster_val
0 POLYGON ((8.56799 47.80800, 8.56799 47.77200, ... 1.0
1 POLYGON ((6.73199 47.12400, 6.73199 47.08800, ... 1.0
I plot them using:
fields.plot(color='white', edgecolor='black')
matplotlib.pyplot.show()
I also have a raster layer (ndvi_layer
) which is basically a numpy array which I plot using:
fig, ax = matplotlib.pyplot.subplots(figsize=(10, 10))
rasterio.plot.show(ndvi_layer, ax=ax, cmap='RdYlGn')
matplotlib.pyplot.show()
Is there any way to plot the polygons on top of the raster? What if the polygons don't have the same CRS as the raster?
No comments:
Post a Comment