0

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()

without_geotiff

As you can see, generated image does not contain my GeoTIF. Any idea how to solve this ?

1 Answers1

0

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.

swatchai
  • 17,400
  • 3
  • 39
  • 58
  • The projection does not seem to be correct. The image is placed inside basemap but with wrong coordinates. This is how my generated map looks like: https://upx.cz/Kt7 This is how it should look like (generated with QGIS): https://upx.cz/Kto Do not consider the color of image, difference is cause by reading 1 band only in my code. – Lubomir Franko Jan 13 '19 at 02:03
  • @LubomirFranko: Try `m.imshow(image.r, extent=image.extent, zorder=10 , origin='upper')` – swatchai Jan 13 '19 at 05:11