In the 1st edition of this course, in May/June 2021, the following topics were addressed. On-line sessions were recorded and made available for students. Material for the course were also made available on the webpage. Students keep access to the materials after the course.
- Presentation, May 28, 2021
- Session May 31, 2021. OSGeo4W installation; QGIS 3; Access to Google satellite imagery with XYZ tile protocol in QGIS; a first spatial analysis problem with QGIS (buffers, clip, difference, merge); QGIS/Processing/History; Python Console; Python objects numeric constant, string, list, dictionary; load package with import; Python editor and options; First script (just copy commands in Processing/History to Python editor); Adapt script so buffer distance is a variable; Adapt script to store folder path and file names in variables; Package os and method os.path.join to define paths.
- Session June 2, 2021. Install new packages in PyQGIS; continuation of previous exercise (faixas-mais.py and faixas-legenda.py) ; Use variables to store folder names and file names; list and remove project layers with python; obtain information (name, CRS, geometry type) about layers; for cycles in python.
- Session 3, June 7, 2021. Introductory exercises and tutorial for Python (dictionary, list, ...). Install package with OSGeo4W shell. Legends for vector layers: Single symbol, categorized symbol and graduated symbols. Change size, color, transparency,etc (scripts "symbols-single-categorized-markers.py" and "symbols-fill-graduate-symbol.py")
- Session 4, June 9 2021.
Simplify script to create vector layer legend. Create dictionary to
hold symbology elements; create list with categories with a for cycle to
read the dictionary; put all together by defining a function.
- Session 5, June 14, 2021. SRTM/DEM data for Portugal (raster). Load raster; determine raster metadata; define pseudocolor symbology. The first code builds each color ramp item separately; the improved code defines a function and uses a for cycle to build a list of color ramp items.
- Session 6, June 16, 2021. part 1; part 2. RGB symbology for multiband images. Convert raster layer values to numpy array. Plots with matplotlib. Identify nodatavalue.
- Session 7, June 21, 2021.
Create new raster from numpy array values, CRS, width and height, and
geo-transform parameters. np.nan no data value. Example with KMeans
function from package sklearn to determine clusters from Landsat 8
multi band image. Load vector layer with WFS protocol. Qt message boxes.
- Session 8, June 23, 2021. Read vector layer from uri with WFS protocol; save a local copy; test if features are valid; delete features from layer; create new feature (using well known text format wkt) and add it to the layer; determine id of largest feature; methods for features and geometries: area(), isGeosValid(), type(). Review QMessageBox.
- Session 9: part 1, part 2 and part 3. Read csv tables and perform joins by attributes; Compare selection by attributes with processing.run('extractbyexpression',...) with for cycle along features and method 'deleteFeatures'. Access data in rows and columns of attribute table, e.g. determine the column where a given string appears most frequently. Access and edit atribute names. Brief use of "regular expressions" and re package. Solving a relatively complex problem with a step by step python script in QGIS (exercise Cascais).
- Session 10. Problem about predicting risk in case of large fire in Serra do Caldeirão, Algarve. Download relevant data; read tables with adicional data to join to georeferenced data, create a NBR image from Landsat imagery, reproject raster data; create legend for vector polygon data; check geometry validity; reduce data size using an efficient rule to remove features (using features bounding box); Qt message boxes to convene information to the user; QGIS tools native:extractbyexpression, native:clip,qgis:rastercalculator, native:joinattributestable, gdal:warpreproject, native:zonalstatisticsfb, native:fieldcalculator