Ecopedia · QGIS · Course · Coming soon

Top functions in QGIS

The expressions, queries and Python snippets ecologists reach for most: in the Field Calculator, in labels and filters, and in the Python console. The full course is on its way. Here is a preview.

Elizabeth Vasiuta
Elizabeth VasiutaEcologist
Pre-register for the course →
QGIS expressions and formulas written on a dark green background
01 · Maths

Mathematical functions

Rounding, unit conversions, areas and lengths for attribute tables and reports.

  • abs()
  • round()
  • sqrt()
  • exp()
  • ln()
  • log10()
  • floor()
  • ceil()
  • pi()
  • $area
  • $length
Area in hectares, 2 decimals
round($area / 10000, 2)
02 · Trigonometry

Trigonometric functions

Bearings, slope angles and orientation of transects, lines and features.

  • sin()
  • cos()
  • tan()
  • asin()
  • acos()
  • atan()
  • atan2()
  • radians()
  • degrees()
  • azimuth()
Bearing of a transect line, in degrees
degrees(azimuth(start_point($geometry), end_point($geometry)))
03 · Queries

Queries and filters

Select by expression, layer filters and conditional styling for survey data.

  • =
  • IN
  • LIKE
  • AND / OR
  • IS NULL
  • CASE WHEN
  • regexp_match()
  • to_date()
Threatened species recorded since 2020
"status" IN ('Endangered', 'Vulnerable') AND "year" >= 2020
04 · Python

PyQGIS snippets

Automate repetitive work from the Python console: loop over features, run tools, batch-process layers.

  • iface.activeLayer()
  • QgsProject.instance()
  • getFeatures()
  • processing.run()
Print each polygon's species and area
layer = iface.activeLayer()
for f in layer.getFeatures():
    print(f["species"], round(f.geometry().area(), 1))
New to QGIS?Start with QGIS: from beginner to pro.
Field namesExamples use sample field names like "species", "status" and "year". Replace them with the fields in your own layer. $area and $length follow your project's ellipsoid and units settings.

Pre-register for the course

Be first to hear when enrolment opens, with early-access pricing for everyone on the pre-registration list.