[QGIS-Developer] Creating Arrays and Maps from aggregates and relations

Andreas Neumann a.neumann at carto.net
Fri Aug 4 12:18:55 PDT 2017


Hi,

At the moment an array or map data structure in an expression can only 
be created by using the array() and map() constructor function where one 
has to explicitly include all the values at the creation of the data 
structure. Arrays can also be created from strings with the 
string_to_array function.

Wouldn't it be useful if the arrays could be created by an aggregate 
function and in particular the relation_aggregate function (esp. useful 
for analyzing 1:n relations)?

Something like: aggregate(layer:='countries', aggregate:='array', 
expression:="area") --> array with all areas of the countries

or

relation_aggregate(relation:='cities_in_countries',aggregate:='array', 
calculation:="towns") --> array with all towns that are related to a 
country.

---------------

Similar for maps:

aggregate(layer:='countries', aggregate:='map', expression:="area", 
mapAttributes:="area, population") --> nested maps with all areas and 
population per country.

or

relation_aggregate(relation:='cities_in_countries',aggregate:='map', 
mapAttributes:="town_name,town_population") --> array with all town 
attributes that are related to a country.

Any thoughts?

Andreas

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20170804/4193447a/attachment.html>


More information about the QGIS-Developer mailing list