Skip to content

ramespada/geotiff-fortran

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

geotiff-fortran

Language GitHub release last-commit

Minimalistic Fortran GeoTIFF module, with sintax inspired on LIBTIFF C-Library.

List of functions available

Open/close file:

  • TIFF_Open (iunit, fileName, 'r', tiff, ierror)
  • TIFF_Close (tiff)

Read commands:

  • TIFF_Get_Tag_Value (tiff, tagId, value)
  • TIFF_Get_Image (tiff, *nimg, image)
  • GTIFF_Get_Key_Value(tiff, keyId, value)
  • GTIFF_Get_Image_Coordinates(tiff, *nimg*, x, y)

Write commands:

  • TIFF_Set_Tag_Value (tiff, tagId, value)
  • TIFF_Set_Image (tiff, *nimg, image)
  • GTIFF_Set_Key_Value(tiff, keyId, value)
  • TIFF_Write_TIFF(tiff)

Example of use

program my_program

   use geoTIFF

   implicit none  
   type(TIFF_FILE) :: my_tiff
   integer              :: ierr,crs
   character(100)       :: descr
   real   , allocatable :: image(:,:),x(:,:),y(:,:)
   
   call TIFF_Open(124,"files/cea.tif",'r', my_tiff, ierr)
   if (ierr==0) then
   
      !get TIFF tag:
      call TIFF_GET_TAG_VALUE(my_tiff, 1, TIFF_ImageDescription, descr)
   
      !get TIFF image:
      allocate(image(my_tiff%nx, my_tiff%ny))
      call TIFF_GET_IMAGE(my_tiff, 1, image)

      !get GeoTIFF key:
      call GTIFF_GET_KEY_VALUE(my_tiff, GKEY_ProjectedCSType, crs)

      !get coordinates
      allocate(x(my_tiff%nx, my_tiff%ny))
      allocate(y(my_tiff%nx, my_tiff%ny))
      call GTIFF_GET_IMAGE_COORDINATES(my_tiff,1,x,y)

      call TIFF_Close(my_tiff)
   else
      stop 'Failed to read TIFF file'
   endif

end program

To-do list:

General:

  • Read/Open function implementation
  • Write/Create function implementation
  • IO-error management

TIFF 6.0 Baseline:

  • Big-Enddian support (swap byte-order)
  • Orientation: different orientation images (not all tested)
  • Compression: PackBits
  • Compression: Modified Huffman (CCITT Group 3,1-D) (only for bilevel data)
  • Multi-image TIFF (more than 1 IFD)
  • Multiband TIFFs
  • Planar configuration TIFFs
  • Extend TIFF_Get_Image for categorical (integer) layers

TIFF 6.0 Extensions:

  • Tiled images
  • Compression: LZW
  • Compression: DEFLATE (LZ77 + Huffman)
  • Differencing predictor algorithm
  • Data Sample Format

OGC GEOTIFF 1.1

  • GeoKey values access
  • Find how to get coordinates info
  • Get proj code (epsg or projstring)

Performance:

  • Memory (RSS)
  • CPU usage testing
  • Parallel access? (is it possible?)

About

Fortran GeoTIFF reader module

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published