0% found this document useful (0 votes)
2 views2 pages

Basic Sheet

The document provides a step-by-step guide for downloading and installing Miniconda, setting up a Python environment, and installing packages like JupyterLab. It also covers basic command prompt commands and GDAL command line basics for image processing. Additional information about Miniforge and package channels is included, along with specific GDAL commands for image format conversion and manipulation.

Uploaded by

Kasper B.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Basic Sheet

The document provides a step-by-step guide for downloading and installing Miniconda, setting up a Python environment, and installing packages like JupyterLab. It also covers basic command prompt commands and GDAL command line basics for image processing. Additional information about Miniforge and package channels is included, along with specific GDAL commands for image format conversion and manipulation.

Uploaded by

Kasper B.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Download python / package manager

Miniconda https://docs.conda.io/projects/miniconda/en/latest/index.html

Install the software / run the .exe file

Set up an environment

conda create –name nameOfEnvironment

Sctivate the environment

conda activate nameOfEnvironment

Install packages

conda install jupyterlab -y # the ‘-y’ just says “yes” in advance

conda install pip # pip will be used in the notebook for downloading packages

Go to working directory and run jupyterlab

jupyter lab # Jupyterlab should now open in an internet browser window

More info: (Not important now, but maybe later)

Miniconda is a smaller version of Anaconda that does not include a lot of preinstalled libraries/packages
(bloatware). This is preferred, since one can just download packages at will.

Miniforge is a nearly identical to miniconda but has “conda-forge” as default channel.

Miniforge https://github.com/conda-forge/miniforge

Channels: The place from where you get your libraries/packages.

Anaconda – free for students and researchers. Others will have to get a license

Conda-forge – free for everyone

You can specific the channel when you download a package. E.g.:

Conda install –c conda-forge numpy # this will download ‘numpy’ from the ‘conda-forge’ channel

It is normally best to have all packages installed from the same channel. But you can mix, anaconda, conda-forge,
pip etc. But problems could arise from doing so.
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 os.system(‘command’)

e.g. os.system(‘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.

https://gdal.org/programs/gdalinfo.html

gdalinfo my_image.tif # lists information about a raster dataset

https://gdal.org/programs/gdal_translate.html # can do changes to formats, resolution, bands, compression etc.

gdal_translate input.tif output.jpg # changes format from tif to jpg

gdal_translate input.vrt output.tif # converts a .vrt to a .tif

gdal_translate –outsize 500 500 input.tif output.tif # changes x y dimensions of image

gdal_translate –tr 10 10 input.tif output.tif # changes pixel resolution of image

gdal_translate –co compress=deflate input.tif output.tif # applies deflate compression

gdal_translate –b 1 –b 2 –b 3 input.tif output.tif # creates a new image with selected bands

https://gdal.org/programs/gdalbuildvrt.html

gdalbuildvrt output.vrt *tif # creates a vrt of all tiff images in the directory

gdalbuildvrt -input_file_list my_list.txt output.vrt # creates a .vrt of all images in a list of files

https://gdal.org/programs/gdaladdo.html

gdaladdo name.vrt 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

https://gdal.org/programs/gdaltindex.html

gdaltindex name.shp *tif # creates an polygon shapefile (or other vector formats – e.g. gpkg) with the footprints of
all images in a directory.

You might also like