These course notes provide an introduction to the usage of Python and R for GIS procedures. The course notes were developed for a hands-on session at the Institute for Nature and Forest Research (INBO), May 2017.
The course can be split up in three main sections:
- Introduction to (scientific) Python: crash course introduction to the Python standard library and some essential scientific Python packages (Numpy/Pandas). Still, for a more extended introduction course of (scientific) Python, check these course notes providing a more extended Python introduction.
- Introduction to Python for GIS: Introduction to some essential vector and raster packages in Python, such as
geopandas
,fiona
,rasterio
, ...
- 03-geopandas-appetizer.ipynb
- 04-gis-python-vectors.ipynb
- 05-the-power-of-gdal.ipynb
- 06-gis-python-rasters.ipynb
- Introduction to R for GIS: introduction to some essential vector and raster packages in R, such as
sp
,raster
,ggmap
, ...
The course notes for the hands-on sessions are available in the notebook folder. For the Python sections, Jupyter notebook is used, while the R course material is available as Rmarkdown notebook files. Check the Github page for the slides. The individual presentations (stored in the docs folder) can be used as guiding presentations to explain the setup and flow of the course. Specific focus is given to the interaction of both languages to the OSGEO libraries (proj.4, geos and gdal), which has been illustrated hands-on o the command line during the course.
The Jupyterhub infrastructure described in the setup of the Python-slideshow has been setup and running for the course sessions at INBO itself. Hence, it is not available as a continuous service. Still, the working Python environment can be setup locally as well, as discussed below.
By installing the Anaconda or Miniconda Python packaging environment, the required environment can be setup using the environment.yml
file. To setup the environment, use the Anaconda navigator tutorial or define the environment with the command line:
conda env create -f environment.yml
After activation of the environment (select the environment in Anaconda Navigator, activate gispython
(windows cmd) or source activate gispython
(linux terminal)), start Jupyter notebooks to work on the Python notebooks. Startgin Jupyter notebook can be done directly from the Anaconda Navigator by command line:
jupyter notebook
Remark: If the usage of the environment file does not work, setup your own environment or install the most essential packages in your current working environment using conda: conda install pandas numpy geopandas rasterio mplleaflet
. This will support most of the course material.
The easiest way to start working on the Rmarkdown files is by using Rstudio as this IDE fully supports the Rmarkdown format. By running the first cells of the 07-gis-r-vectors.Rmd notebook, the required dependencies will be installed.
These course notes are highly inspired by some interesting other sources:
- Excellent Using Geospatial Data With Python at the Scipy 2013 conference and Geospatial Data with Open Source Tools in Python at the Scipy 2015 conference by
kjordahl
. - Extended and great R-GIS introduction by Robert Hjimans
- Nice Introduction to Spatial Data Types in R notes by Claudia Engel
- Geoscripting course by Wageningen University
- Internal INBO course material provided by Thierry Onkelinx
- The Python GDAL/OGR cookbook by Jared Erickson
- The Automating GIS processes course by Henrikki Tenkanen
- Package/libraries documentation of the used packages/libraries