Minimalistic Fortran GeoTIFF module, with sintax inspired on LIBTIFF C-Library.
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)
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 programGeneral:
- 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_Imagefor categorical (integer) layers
TIFF 6.0 Extensions:
- Tiled images
- Compression: LZW
- Compression: DEFLATE (LZ77 + Huffman)
- Differencing predictor algorithm
- Data Sample Format
- 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?)