Skip to main content
added 20 characters in body; edited tags; edited title
Source Link
Babel
  • 80.4k
  • 15
  • 97
  • 245

QGIS select by expression based on different elements concatenated inside a string

Using the field filter or advanced filter expression in the attribute table of QGIS, I want to select features that have values in the first three levels and exclude features that values other than zero in levels four and onward.

Using the example data below, I want to select A and B, but not C.

Example Attribute data (letters and brackets and '...' are not in attribute table):

A] 100-000025-000000-000000-000000-000000-000000...

B] 100-000061-136148-000000-000000-000000-000000...

C] 100-023788-278991-424721-236628-000000-000000...

A] 100-000025-000000-000000-000000-000000-000000... B] 100-000061-136148-000000-000000-000000-000000... C] 100-023788-278991-424721-236628-000000-000000... 

The value is a 144 character string broken into 21 levels. The levels in the code represent the hierarchy of the stream network – a major river would have only Level 1 of the code populated, a stream flowing directly into a major river would have levels 1 and 2 populated, and a stream flowing into this stream would have levels 1, 2 and 3 populated, and so on.

BC FWA Watershed Code

QGIS select by expression

Using the field filter or advanced filter expression in the attribute table of QGIS, I want to select features that have values in the first three levels and exclude features that values other than zero in levels four and onward.

Using the example data below, I want to select A and B, but not C.

Example Attribute data (letters and brackets and '...' are not in attribute table):

A] 100-000025-000000-000000-000000-000000-000000...

B] 100-000061-136148-000000-000000-000000-000000...

C] 100-023788-278991-424721-236628-000000-000000...

The value is a 144 character string broken into 21 levels. The levels in the code represent the hierarchy of the stream network – a major river would have only Level 1 of the code populated, a stream flowing directly into a major river would have levels 1 and 2 populated, and a stream flowing into this stream would have levels 1, 2 and 3 populated, and so on.

BC FWA Watershed Code

QGIS select by expression based on different elements concatenated inside a string

Using the field filter or advanced filter expression in the attribute table of QGIS, I want to select features that have values in the first three levels and exclude features that values other than zero in levels four and onward.

Using the example data below, I want to select A and B, but not C.

Example Attribute data (letters and brackets and '...' are not in attribute table):

A] 100-000025-000000-000000-000000-000000-000000... B] 100-000061-136148-000000-000000-000000-000000... C] 100-023788-278991-424721-236628-000000-000000... 

The value is a 144 character string broken into 21 levels. The levels in the code represent the hierarchy of the stream network – a major river would have only Level 1 of the code populated, a stream flowing directly into a major river would have levels 1 and 2 populated, and a stream flowing into this stream would have levels 1, 2 and 3 populated, and so on.

BC FWA Watershed Code

Source Link
CD.Edwards
  • 397
  • 1
  • 11

QGIS select by expression

Using the field filter or advanced filter expression in the attribute table of QGIS, I want to select features that have values in the first three levels and exclude features that values other than zero in levels four and onward.

Using the example data below, I want to select A and B, but not C.

Example Attribute data (letters and brackets and '...' are not in attribute table):

A] 100-000025-000000-000000-000000-000000-000000...

B] 100-000061-136148-000000-000000-000000-000000...

C] 100-023788-278991-424721-236628-000000-000000...

The value is a 144 character string broken into 21 levels. The levels in the code represent the hierarchy of the stream network – a major river would have only Level 1 of the code populated, a stream flowing directly into a major river would have levels 1 and 2 populated, and a stream flowing into this stream would have levels 1, 2 and 3 populated, and so on.

BC FWA Watershed Code