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

Arnaud Morvan arnaud.morvan at camptocamp.com
Fri Aug 4 13:02:49 PDT 2017


Hi,

As "array" is already a key word in QGIS expressions, to aggregate 
values in an array, I would propose to use the same as postgis : "array_agg"


Le 04/08/2017 à 21:18, Andreas Neumann a écrit :
>
> 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
>
>
>
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

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


More information about the QGIS-Developer mailing list