Geographic Information Systems Asked by LeoC on March 10, 2021
Would it be possible in a QGIS form to create a list of values with the array()
function in the expression builder? This array would change, depending on different conditions.
The Value Relation widget is close to what I need, but it has to have one connected table, and the values in the list are only from this table. I’d like to add multiple conditions and values modifications.
Let’s say I have 3 layers:
geometry | "type" |
---|---|
line | ‘underground’ |
‘aerial’ |
geometry | "size" |
---|---|
line | ‘big’ |
‘small’ |
geometry | "equipment" |
---|---|
point | ‘big pole’ |
‘large pole’ | |
‘high pole’ | |
‘small pole’ | |
‘thin pole’ | |
‘low pole’ | |
‘big chambre’ | |
‘large chamber’ | |
‘deep chamber’ | |
‘small chamber’ | |
‘thin chamber’ | |
‘shallow chamber’ |
For exemple, for big and underground cables, an array of possible big chambers, and for small and aerial cables, an array of possible small telecom poles.
This Expression would produce the array of possible equipment on a the equipment layer when opening an form.
with_variable('lineType',
aggregate(
layer:='infra',
aggregate:='max',
expression:="type",
filter:=intersects( $geometry, geometry(@parent) )),
with_variable('linesSize',
aggregate(
layer:='telecomLines',
aggregate:='max',
expression:="size",
filter:=intersects( $geometry, geometry(@parent) )),
if (@lineType = 'underground',
map_get( map( 'big', array('big chambre', 'large chamber', 'deep chamber'),
'small', array('small chamber', 'thin chamber', 'shallow chamber')),
@lineType),
if (@lineType = 'aerial',
map_get( map( 'big', array('big pole', 'large pole', 'high pole'),
'small', array('small pole', 'thin pole', 'low pole')),
@linesSize),
--(Else)
array('big pole', 'large pole', 'high pole', 'small pole',
'thin pole', 'low pole', 'big chambre', 'large chamber', 'deep chamber',
'small chamber', 'thin chamber', 'shallow chamber')))))
here’s a quick map of the exemple on qgis Cloud:
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP