Command prompt basics
cd changes directory # cd my_folder
cd.. goes back to previous directory
dir lists all files in a directory
mkdir creates a new directory # mkdir new_folder
start opens a new command prompt window in the given directory
start . opens the folder/directory you are located in (in windows GUI)
python runs a python script # python my_script.py
Arrow up pervious line
Tab autocomplete
GDAL command line basics
Can also be run from within python by using [Link](‘command’)
e.g. [Link](‘gdal_translate C:/folder/my_file.tif C:/folder/my_file.jpg’)
Many of the functions have also been implemented in python but the names and syntax is a bit different.
[Link]
gdalinfo my_image.tif # lists information about a raster dataset
[Link] # can do changes to formats, resolution, bands, compression etc.
gdal_translate [Link] [Link] # changes format from tif to jpg
gdal_translate [Link] [Link] # converts a .vrt to a .tif
gdal_translate –outsize 500 500 [Link] [Link] # changes x y dimensions of image
gdal_translate –tr 10 10 [Link] [Link] # changes pixel resolution of image
gdal_translate –co compress=deflate [Link] [Link] # applies deflate compression
gdal_translate –b 1 –b 2 –b 3 [Link] [Link] # creates a new image with selected bands
[Link]
gdalbuildvrt [Link] *tif # creates a vrt of all tiff images in the directory
gdalbuildvrt -input_file_list my_list.txt [Link] # creates a .vrt of all images in a list of files
[Link]
gdaladdo [Link] 2 4 8 16 # creates overview of a vrt or raster which significantly speeds of the view/interaction in
a GIS software – can take a long time if many overviews are computed on a large image. Very useful for .vrts. The
numbers given a just an example
[Link]
gdaltindex [Link] *tif # creates an polygon shapefile (or other vector formats – e.g. gpkg) with the footprints of
all images in a directory.