Link for classes (zoom): https://videoconf-colibri.zoom.us/j/2976334879
Link for Telegram group: https://t.me/+qXbma7g4TXQwZTNk
Installing QGIS through OSGeo4W (windows); using OSGeo4W shell to install Python packages:
- Downloading and installing QGIS (instructions for installing QGIS via the OSGeo4W distribution manager). https://www.e-education.psu.edu/geog489/node/2294
- 1st: go to https://qgis.org/en/site/forusers/download.html and download OSGeo4W Network installer (Window users)
- 2nd: execute the downloaded file osgeo4w-setup.exe (follow instructions in https://www.e-education.psu.edu/geog489/node/2294): this will take some time... Files will be typically installed in C:\OSGeo4W. Important files:
- Note: to install packages that require dependencies which are hard to install later in the shell, choose advanced installation and choose the packages you want to install (e.g. python3-geopandas; python3-fiona; can also install useful packages like rasterio; check geowombat, scipy, sklearn, etc)
- C:\OSGeo4W\OSGeo4W.bat - This opens the OSGeo4W shell that can be used for executing python scripts from the command line.
- C:\OSGeo4W\bin\qgis-ltr-bin.exe - This is the main QGIS executable that you need to run for starting QGIS 3.
- Obs: we will execute scripts directly in QGIS, so the OSGeo4W shell (windows key+ OSGeo4W shell) will only be needed to install Python packages (see below). Anyway, to run the Python interpreter from the OSGeo4W shell one should execute python-qgis-ltr -- leave with "quit()".
- Installing pip (most likely not necessary since it should be included in the above installation): https://pip.pypa.io/en/stable/installation/
- Installing a python package that is not included in OSGeo4W: Exemple: Install package sklearn (package for Data Science not included in OSGeo4W): 1st: open OSGeo4W shell (window key+ osgeo4w shell); 2nd:
execute "python -m pip install --user sklearn" in OSGeo4W shell; 3rd:
in the python console of QGIS do "import sklearn" to verify that it is loaded correctly (i.e. there is no error message). Exercise: install package haversine (distances over the sphere).
Documentation (QGIS, PyQGIS):
- (main resource: tutorial and a reference guide) PyQGIS Developer Cookbook. https://docs.qgis.org/3.22/en/docs/pyqgis_developer_cookbook/index.html or https://docs.qgis.org/testing/pdf/en/QGIS-testing-PyQGISDeveloperCookbook-en.pdf
- Documentation for QGIS (also accessible through QGIS Python editor). https://docs.qgis.org/3.22/en/docs/index.html
- QGIS Python API: https://qgis.org/pyqgis/master/core/index.html
Introductory tutorials to PyQGIS:
- PyQGIS 101: Introduction to QGIS Python programming for non-programmers. https://anitagraser.com/pyqgis-101-introduction-to-qgis-python-programming-for-non-programmers/
- Tutorial on QGIS 3 programming with Python (PyQGIS). https://www.geodose.com/p/pyqgis.html
Customizing QGIS with Python (Full Course Material) 3.16: https://courses.spatialthoughts.com/pyqgis-in-a-day.html#
QGIS in macOS:
QGIS macOS packages: https://www.kyngchaos.com/software/qgis/
- discussion on Installing Python modules for QGIS 3 on MacOS: see instructions to set path in QGIS to the directory with python modules
- Hot Examples (Search Python code examples from over 1.000.000 projects). https://python.hotexamples.com/
- PyGIS - Open Source Spatial Programming & Remote Sensing; geowombat; geopandas; rasterio
Geopackage and SQLite:
- How to create and populate a geopackage in QGIS (video)
- Load geopackage layers with PyQGIS;
- Working with Geospatial Data: An Introduction (SQLite and geopackage in QGIS; no PyQGIS)
- Arthur Lembo Jr: How do I do that in SpatialLite and SQLite (many examples of spatial SQL queries)
- Categorized legend for vector layer: https://gis.stackexchange.com/questions/318474/setting-style-for-categorized-vector-in-pyqgis
- Lists, Tuples, and Sets
- Strings - Working with Textual Data
- Dictionaries
- Loops and iterations
- Python comprehensions are a very natural and easy way to create lists, dicts, and sets
- Functions
- How to read and write to file
- How to work with csv files using the csv module
- Modules, import, sys.path, random, math, os, webbrowser
- os Module
- How to read, write, and match regular expressions with the re module
- Working with JSON Data using the json Module
- Datetime Module - How to work with Dates, Times, Timedeltas, and Timezones
- Classes and Instances
- About inheritance and how to create subclasses
- Class Variables
- classmethods and staticmethods
- iterators and iterables
- Pandas using Python.
- Pandas DataFrame and Series objects.
- Pandas indexes.
- How to get started with Matplotlib.
- Create bar charts in Matplotlib.
- Create pie charts in Matplotlib.
- Create histograms in Matplotlib.
- Create scatter plots in Matplotlib.
GDAL: An Introduction to GDAL: https://www.youtube.com/watch?v=N_dmiQI1s24
1st Edition of the course "Unleash QGIS with Python" (June 2021)
Youtube channel "QGIS 3 em português": an introduction to QGIS 3 (in portuguese)