7

Is there any way (a package or what not), to visualize a GeoTIFF image directly in Python?

I don't want to use ENVI or ArcGIS or anything else.

2
  • What do you mean by 'visualize'? Do you want to see the image in the context of a coordinate system, or just view the image itself?
    – nagytech
    Jul 17, 2012 at 0:00
  • Just the image itself. Althought a coordinate system would be nice, I'm not sure about what you mean with this but you made me think RGB coordinates.
    – JEquihua
    Jul 17, 2012 at 2:22

6 Answers 6

6

if you are interested with RS - Remote Sensing, you can check out Orfeo Toolbox here. following information from their site:

a set of algorithmic components, adapted to large remote sensing images, which allow to capitalize the methodological know how, and therefore use an incremental approach to benefit from the results of the methodological research.

orfeo

i hope it helps you...

2
  • +1 This is excellent! Have you ever used Orfeo for tree cover classification?
    – Aaron
    Jul 17, 2012 at 12:41
  • this is an opensource project... i have only checked out his capability for image processing. i have usually been using envi for now to my licence expire for enterprise works and it is really very good when u work with multi-spectral images.
    – urcm
    Jul 17, 2012 at 14:06
5

you can use also Matplotlib with the cartographic module (Basemap) without problem, see, for example, Retrieving last images from MODIS Satellites and ploting earthquakes or Python: visualiser en temps quasi réel les images satellites et les shapefiles MODIS ou les données sismiques de l'USGS (in french)

3

You can use PIL and Tkinter or other GUI framework to create a simple image viewer. If PIL is unable to read the image you could use GDAL to convert it to a suitable format before displaying it.

Here's a Tkinter example: http://codeidol.com/python/python3/A-Tkinter-Tour,-Part-1/Viewing-and-Processing-Images-with-PIL/

1
  • I want to visualize REALLY simple images, made by myself, like a 500 x 500 constant matrix with salt and pepper noise. Should be pretty straight forward right? It must be a geotiff file though. ... Dammit, now I'm not sure, anyway, I'll look into what you propose, thanks a lot!
    – JEquihua
    Jul 17, 2012 at 2:30
3

PIL (with a limited set of tiff file types) or ImageMagick would to the trick.

3

Nothing beats GDAL

from osgeo import gdal
import matplotlib.pyplot as plt
ds = gdal.Open('file.tif').ReadAsArray()

im = plt.imshow(ds)
plt.colorbar(im)

And to do some proper mapping with projections included use cartopy

3

Rasterio and matplotlib has all the functionality you need to display and manipulate multiband raster data. For example, here is how you can plot a RBG image using Rasterio:

import rasterio
from rasterio.plot import show

indata = '/path/to/your/imagery.tif'

# Note that example uses 4 band NAIP imagery
with rasterio.open(indata) as src:
    arr = src.read([1,2,3], masked=True)
    show(arr)

enter image description here

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.