I am trying to display GeoTIFF file in specified area. What I want to do is project multiband GeoTIFF file to specified area.
My GeoTIFF is satellite image containing 3 bands over area of Europe. I want to project it to area of Central Europe (extent defined by lat/lot). I have been trying to solve this using rasterio but I've been unlucky so far. This is what I get after executing:
import georaster
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
from matplotlib.pyplot import figure
#define path to geotiff
file = "/home/lubomir/Desktop/Sentinel3_OLCI/RGB/OLCI_201812140859_Natural_Color.tif"
m = Basemap(epsg=3395,llcrnrlat=45,urcrnrlat=55,\
llcrnrlon=5,urcrnrlon=25,lat_ts=15,resolution='f')
m.drawcoastlines(linewidth=0.5, color='g')
m.fillcontinents(color='beige')
m.drawcountries(linewidth=0.5, color='m')
#load GeoTIFF multiband file
image = georaster.MultiBandRaster(file)
plt.imshow(image.r, extent=image.extent, zorder=10)
plt.savefig('test.tiff')
plt.show()
As you can see, generated image does not contain my GeoTIF. Any idea how to solve this ?
In order to make use of the Basemap's projection, you must use
m.imshow(image.r, extent=image.extent, zorder=10)
in place of
plt.imshow(image.r, extent=image.extent, zorder=10)
Hope it helps.