Geographic Information Systems Asked on January 17, 2021
I would like to select more features with expression in a specific field, which contains the name of the attribute (IN
operator is useful). Moreover, the name could not be exact, so the ILIKE
operator is necessary.
How can I match these 2 operators in one expression?
For example, I need to select 2 city called ‘Rome’ and ‘New York’.
"city" in ('Rome','New York') -> selected both
"city" in ('rom','new yor') -> not selected
Any suggestion to select in the second case in QGIS?
You can achieve this task using arrays.
name
column contains it or not, using ilike
array_contains(
array_foreach(
ARRAY('%rom%','new yor%'),
name ilike @element),
true)
Correct answer by JGH on January 17, 2021
Additionally you may try using regexp_match()
function
regexp_match("City", '((?i)new yor|(?i)rom)')
The result of this query will select 'Rome' and 'New York' including their derivatives, see image below
References:
Answered by Taras on January 17, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP