Skip to content

nkeikon/tifviewer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

viewtif

Downloads PyPI version Python version

A lightweight GeoTIFF viewer for quick visualization directly from the command line.

You can visualize single-band GeoTIFFs, RGB composites, HDF, NetCDF files and shapefile overlays in a simple Qt-based window.

Installation

pip install viewtif

Note: Requires Python 3.10 or higher. On Linux, you may need python3-tk, libqt5gui5, or PySide6 dependencies.

viewtif requires a graphical display environment.
It may not run properly on headless systems (e.g., HPC compute nodes or remote servers without X11 forwarding).

Optional features

Shapefile overlay support

pip install "viewtif[geo]"

Note: For macOS(zsh) users: Make sure to include the quotes, or zsh will interpret it as a pattern.

NetCDF support

pip install  "viewtif[netcdf]"

Note: For enhanced geographic visualization with map projections, coastlines, and borders, install with cartopy: pip install "viewtif[netcdf]" (cartopy is included in the netcdf extra). If cartopy is not available, netCDF files will still display with standard rendering.

HDF/HDF5 & FileGDB support

GDAL is required to open .hdf, .h5, .hdf5, and .gdb files.

brew install gdal     # macOS
sudo apt install gdal-bin python3-gdal  # Linux
pip install GDAL

Quick Start

# View a GeoTIFF
viewtif ECOSTRESS_LST.tif

# View an RGB composite
viewtif --rgbfiles \
  HLS_B04.tif \
  HLS_B03.tif \
  HLS_B02.tif

# View an RGB composite from a multi-band file
viewtif rgb.tif --rgb 4 3 2

# View with shapefile overlay
viewtif ECOSTRESS_LST.tif \
  --shapefile Zip_Codes.shp

# Change the color and width
viewtif ECOSTRESS_LST.tif \
  --shapefile Zip_Codes.shp --shp-color red --shp-width 2

Update in v1.0.6: HDF/HDF5 support

viewtif can open .hdf, .h5, and .hdf5 files that contain multiple subdatasets. When opened, it lists available subdatasets and lets you view one by index. You can also specify a band to display (default is the first band) or change bands interactively with '[' and ']'.

# List subdatasets
viewtif AG100.v003.33.-107.0001.h5

# View a specific subdataset
viewtif AG100.v003.33.-107.0001.h5 --subset 1

# View a specific subdataset and band
viewtif AG100.v003.33.-107.0001.h5 --subset 1 --band 3

Note: Some datasets (perhaps the majority of .hdf files) lack CRS information encoded, so shapefile overlays may not work. In that case, viewtif will display: [WARN] raster lacks CRS/transform; cannot place overlays.

Update in v1.0.7: File Geodatabase (.gdb) support

viewtif can now open raster datasets stored inside Esri File Geodatabases (.gdb). When you open a .gdb directly, viewtif will list available raster datasets first, then you can choose one to view.

# List available raster datasets
viewtif /path/to/geodatabase.gdb

# Open a specific raster
viewtif "OpenFileGDB:/path/to/geodatabase.gdb:RasterName"

Note: If multiple raster datasets are present, viewtif lists them all and shows how to open each. The .gdb path and raster name must be separated by a colon (:).

Update in v1.0.7: Large raster safeguard

As of v1.0.7, viewtif automatically checks the raster size before loading.
If the dataset is very large (e.g., >20 million pixels), it will pause and warn that loading may freeze your system.
You can proceed manually or rerun with the --scale option for a smaller, faster preview.

Update in v0.2.2: NetCDF support with optional cartopy visualization

viewtif now supports NetCDF (.nc) files via xarray, with optional cartopy-based geographic visualization. Use [ / ] to move forward or backward through time steps, and press M to switch between the three built-in colormaps ("RdBu_r", "viridis", "magma").

Update in v0.2.6: New user controls for NetCDF visualization

  • --vmin [value] --vmax [value] let you set the display range (for all file types).
  • --timestep [int] lets you jump directly to a chosen time slice.
  • cartopy off let you see raw NetCDF images.

Examples

viewtif data.nc
viewtif data.nc --vmin 280 --vmax 320
viewtif data.nc --timestep 100
viewtif data.nc --cartopy off

Controls

Key Action
+ / - or mouse / trackpad Zoom in / out
Arrow keys or WASD Pan
C / V Increase / decrease contrast
G / H Increase / decrease gamma
M Toggle colormap. Single-band: viridis/magma. NetCDF: RdBu_r/viridis/magma.
[ / ] Previous / next band (or time step)
R Reset view

Features

  • Command-line driven GeoTIFF viewer.
  • Supports single-band, RGB composite, HDF/HDF5 subdatasets, and NetCDF.
  • Optional shapefile overlay for geographic context.
  • Adjustable contrast, gamma, and colormap.
  • Fast preview using rasterio and PySide6.

Example Data

Credit & License

viewtif was inspired by the NASA JPL Thermal Viewer — Semi-Automated Georeferencer (GeoViewer v1.12) developed by Jake Longenecker (University of Miami Rosenstiel School of Marine, Atmospheric & Earth Science) while at the NASA Jet Propulsion Laboratory, California Institute of Technology, with inspiration from JPL’s ECOSTRESS geolocation batch workflow by Andrew Alamillo. The original GeoViewer was released under the MIT License (2025) and may be freely adapted with citation.

Citation

Longenecker, Jake; Lee, Christine; Hulley, Glynn; Cawse-Nicholson, Kerry; Gleason, Art; Otis, Dan; Galdamez, Ileana; Meiseles, Jacquelyn. GeoViewer v1.12: NASA JPL Thermal Viewer—Semi-Automated Georeferencer User Guide & Reference Manual. Jet Propulsion Laboratory, California Institute of Technology, 2025. PDF.

Contributors

  • @HarshShinde0 — added mouse-wheel and trackpad zoom support; added NetCDF support with @nkeikon
  • @p-vdp — added File Geodatabase (.gdb) raster support

License

This project is released under the MIT License © 2025 Keiko Nomura.

If you find this tool useful, please consider supporting or acknowledging the author.

Useful links

About

A simple GeoTIFF viewer for the command line

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages