GDAL Command-line Cookbook

Introduction

Welcome to the GDAL Users Cookbook. This guide provides practical examples for working with raster and vector data using the GDAL command-line tools. It demonstrates common tasks such as raster analysis, vector geometry operations, and combining raster and vector workflows.

The cookbook uses a question and answer format, linking to relevant examples elsewhere in the GDAL documentation.

General How do I...

... get the GDAL version?

Display the GDAL version

Raster How do I...

... resize a raster?

Resize a dataset to 1000 columns and 500 lines using cubic resampling.

... create a Cloud Optimized GeoTIFF (COG)?
... check if a GeoTIFF is a Cloud Optimized GeoTIFF (COG)?

Vector How do I...

... check if X vector driver is installed?

Check if the vector Parquet driver is installed

... buffer geometries?

Compute a buffer of one km around input geometries (assuming the CRS is in meters)

... buffer geometries using an attribute?

Buffer a line dataset to create a new polygon dataset.

... list all layers in a dataset?

Raster and Vector How do I...

... burn a vector dataset into a raster?

Burn a shapefile into a raster

... extract pixel values from a raster and apply them to a point dataset?

Reading coordinates to extract from an input GeoPackage file and writing the output to a GeoPackage file

... know which CRSs are suitable for reprojecting my dataset?

Auto-completion of EPSG CRS codes