Reading GeoTiff file using Xarray in Python

GeoTIFF is a public domain metadata standard which allows georeferencing information to be embedded within a TIFF file.

In this tutorial we will learn how we can read a GeoTiff file and read data stored in it using a python package xarray .

Opening a GeoTiff file

da = xr.open_rasterio(‘test.tif’)

Multi-Dimensional GeoTiff read as DataArray

Here Coordinates are various dimensions available in this tiff file , Attributes are various image attributes of the tiff image .

Get values from DataArray


Getting Values based on a particular Co-ordinate values

ds = da.isel(x=3368, y=312)

Single Value Extracted from GeoTiff

In the next post will discuss how we can create a raster file format using multiple tiff images to store historical data and store them in netcdf file format .

About Ujjwal Gupta 1 Article
Senior Data Engineer

Be the first to comment

Leave a Reply