I have some
tiffs that I'd like to plot interactively in python using
folium (or any other package, but I don't know of any). My problem is, that I have many na-values in the raster. At the moment I read in the raster with
rasterio, read the data into a 2d-
numpy-array, and then I write it back out as
Finally I use
rasterlayer = folium.FeatureGroup(name = "raster") rasterlayer.add_child(folium.raster_layers.ImageOverlay( image=ndvi, bounds=[[bottom, left], [top, right]], interactive=True, cross_origin=False, zindex=1, colormap=matplotlib.pyplt.cm.Greens )) m.add_child(rasterlayer) m.add_child(folium.LayerControl()) m
But I get all the NA-Values printed in some colour. And I didn't find any solution to that problem. I had a look here:
but also did not really help.
I also did set all NA-values in the "numpy"-array to
0, but this also was not the solution. The NA-Values always got plotted. Is there some, relatively easy way, to omit the plotting of na values. And more general: What is a good way of plotting raster with folium? It seems that in
R it's so easy with packages like
tmap and in
python it feels way more complicated...