TransWikia.com

QGIS modelbuilder, having a choicebox/value map of strings as string input

Geographic Information Systems Asked on November 18, 2020

I was wondering how you can get a choicebox/value map in the string input? Right now we have to type in value in but we would like to have it that has a choicebox/listbox to save time with typing.

enter image description here

One Answer

I have kind of found my answer though it is kind of annoying and I wish there was a better one.

STEP ONE:

To get a choice box you have to use the FIELD MAPPER input parameter and then define your choices there. However keep in mind that these are actually numbers that need to be converted to strings.

STEP TWO:

The problem is however when you convert a number to a string, you of course do not have the actual value of the mapper. To make sure it gets the right value you build a CASE EXPRESION in the column where the value is to be inputed.

CASE 
WHEN to_string(@achtergrondondergrond2) ='0'
THEN
'GRB'
WHEN to_string(@achtergrondondergrond2) ='1'
THEN
'CADMAP'
WHEN to_string(@achtergrondondergrond2) ='2'
THEN
'KADVEC'
WHEN to_string(@achtergrondondergrond2) ='3'
THEN
'KADSCAN'
WHEN to_string(@achtergrondondergrond2) ='4'
THEN
'WPB'
WHEN to_string(@achtergrondondergrond2) ='5'
THEN
'TOPO'
WHEN to_string(@achtergrondondergrond2) ='6'
THEN
'ANDERE'
ELSE
null 
End

And your done, wish there was a better solution but this is the best we can do now apparently.

Answered by ThunderSpark on November 18, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP