Working with GeoSpatial Data — Part:2, Understanding file formats

Manish Sahu
3 min readMar 30, 2019

--

Introduction

In the previous Part-1 blog, we worked with reading and writing of GeoSpatial datasets. There are multiple file formats that support geo-referencing. In Raster formats like TIF, IMG, VRT, ECW, JP2 etc can support some kind of georeferencing. The most famous and widely used is the TIF format. It supports internal georeferencing and not extra supporting file (tfw, pgw, prj etc) is needed to work with. All the other formats need supporting files.

Note1 — TIF is known in multiple names like TIFF, GeoTIFF, GeoTIF. But these all mean the same.

Attributes

  1. Supporting data types

TIF also supports multiple data types like Byte, UInt16, Int16, UInt32, Int32, Float32, Float64, CInt16, CInt32, CFloat32 and CFloat64 are supported for both reading and writing.

2. Transparency

TIF files can contain internal transparency masks. It means instead of showing black pixels where there is no data, transparency of image is maintained. See image below to understand this better.

Image 1 — It doesn’t account for transparency and black pixels are displayed where there is nodata, Image 2 — It properly account for transparency and no pixels are displayed.

3. Overviews

Overviews or Pyramids are low-resolution level of detail data which is used to improve the performance of software opening TIF. ESRI here explained this very well. The GeoTIFF driver supports reading, creation, and update of internal (along with TIF, no extra file) overviews.

4. Metadata

This is the most important attribute of TIF dataset. It contains georeferencing information, Bounds, Size, Projection system, Pixel Size, etc. See below to get the details of the metadata object. For example — PROJCS represents a coordinate system of TIF.

Driver: GTiff/GeoTIFF
Files: Ortho.tif
Size is 62223, 45930
Coordinate System is:
PROJCS["WGS 84 / UTM zone 44N",
GEOGCS["WGS 84",
DATUM["WGS_1984",
SPHEROID["WGS 84",6378137,298.257223563,
AUTHORITY["EPSG","7030"]],
TOWGS84[0,0,0,0,0,0,0],
AUTHORITY["EPSG","6326"]],
PRIMEM["Greenwich",0],
UNIT["degree",0.0174532925199433],
AUTHORITY["EPSG","4326"]],
PROJECTION["Transverse_Mercator"],
PARAMETER["latitude_of_origin",0],
PARAMETER["central_meridian",81],
PARAMETER["scale_factor",0.9996],
PARAMETER["false_easting",500000],
PARAMETER["false_northing",0],
UNIT["metre",1,
AUTHORITY["EPSG","9001"]],
AUTHORITY["EPSG","32644"]]
Origin = (391824.812343188037630,2563954.159405739512295)
Pixel Size = (0.049987000000000,-0.049987000000004)
Metadata:
AREA_OR_POINT=Area
Image Structure Metadata:
COMPRESSION=LZW
INTERLEAVE=PIXEL
Corner Coordinates: ...
Band 1 Block=256x256 Type=Byte, ColorInterp=Red
Overviews: 31112x22965, 15556x11483, 7778x5742, 3889x2871, 1945x1436, 973x718, 487x359, 244x180

5. Compression

TIF supports numerous compression JPEG, LZW, etc. A complete list can be found here. Compression can be lossy like JPEG or lossless like LZW. Lossy compression is best suited for RGB colored 3-band TIFs. Compression can be very useful and brings down size of file drastically. For example — A compressed RGB TIF size is 169MB and uncompressed size is 3.40 GB. We can get compression method from metadata of TIF file as given above.

Note2 — Doing JPEG will remove transparency from the TIF

6. BigTiFF

Maximum size a normal TIF file can support is 4GB. Above it, BIGTiFF is used. Although it acts almost similar to normal TIF and we shouldn’t worry much about it. Just remember to check BIGTIFF yes when saving a large TIF file.

7. Streaming operations

This is the most interesting part of TIF, we can actually read TIF dataset directly from the web without downloading of local PC. I will cover this topic in detail in the late blogs.

Now, that you have a good understanding of TIF dataset. We can read and manipulate these attributes using GDAL python library too. In the next blog, I will cover how to read these attributes and also manipulate some of it using python. You can write to me at manishsahu53@live.com if you have any questions regarding Geospatial tech.

--

--