Project: QGIS

Version: 2.12.0

Feature: New expression functions in 2.12

A set of functions for "fuzzy matching" have been added. These include functions for finding the similarity of two strings and also for performing phonetic matching between strings, and allow you to perform filters for records which "nearly match" a specified string.

More geometry based functions have been added, including

  • num_points(geometry) for calculating the number of nodes in a geometry
  • area(geom), length(geom) and perimeter(geom), for calculating the area, length and perimeter of any geometry object. Previously only calculation of the area, length and perimeter of the current feature's geometry was possible.
  • start_point(geom), end_point(geom), point_n(geom), for retrieving the first, last and numbered points from a geometry
  • make_point(x,y), for manual creation of a point geometry
  • x(geom), y(geom) functions which return the x and y coordinate for point geometries or the centroid x/y for non-point geometries

A new project_color function has been added, which allows you to retrieve a color from the project's color scheme by name. This lets you create 'linked colors', where the color of symbol or labeling components can be bound to a color in the project's color scheme. Update the color in the scheme, and all the linked colors will be automatically refreshed to match!

Additionally, some very useful expressions have been ported from the expressions+ plugin, including:

  • color_part: allows retreival of a specific color component (eg red, hue, alpha) from a color
  • set_color_part: allows a specific color component to be overridden, eg alter the alpha value (opacity) of a color
  • day_of_week: returns the day of week as a number from a date

Additionally, the context help for expression functions has been improved for better readability.