Geographic Information Systems Asked on August 24, 2021
I have a problem.
I am digitizing the map and I want to distinguish one group of polygons from the other group.
The basic difference between them lies in their ID (string). One of them has the ID starting from SE-1-… and the other ones start from SE-2-…
I found some hints here:
How to select features containing specific text string using an expression in QGIS
which unfortunately doesn’t work in my example.
Once I write down the function, next press the "Add" (plus) button I am getting the box allocated for "All other values".
Is there any way to separate these 2 groups by this part of the string?
Categorizing by ID doesn’t make sense, because all polygon get their unique color, which makes a terrible mess.
UPDATE:
Function is not valid, the details are in the box below:
In addition to Cyrmel:
The formula is "TITLE" LIKE '%SE-2%'
and than you have to classify (to 1/0 or true/false). If you want, you can also change manually the 0 and 1 in the legend.
Correct answer by Christophe P. on August 24, 2021
You did not specify the value which triggers whether your polygon should go into the first group or not - "TITLE" LIKE %SE-2%
returns 1 for true and 0 for false. instead of "all other Values", set one colour to 1 and one to 0.
Answered by Cyrmel on August 24, 2021
Have you tried Conditional expressions like IF or CASE? Something like if( "TITLE" = 'SE-1' , 1, 0 )
Answered by Nelson Silva on August 24, 2021
TITLE
FieldThe expression substr("TITLE", 4, 1)
returns the fourth character of the string. If the TITLE
field is consistently formatted, this will correspond to the particular category, either 1 or 2. Just enter that expression and click classify.
Alternatively, you could modify substr
's starting position and length, or if the SE-# is always at the beginning, simply use left("TITLE", 4)
to get the SE-# text, not just the number.
TITLE
FieldIf the SE-# text does not consistently appear at the beginning of the string, you can use the regex_substr
function. This is easiest for grabbing the entire SE-# text, but can be modified to grab just the number, or you can nest it within a right
function instead.
regexp_substr("TITLE", 'SE-[1,2]')
Answered by JoshC on August 24, 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