By Woody


2019-02-06 14:14:27 8 Comments

I have a geopackage file which contains point data with column of 'depth of cover' and score. In the score column I am using the field calculation to create an expression so that any number less than 0.5 in the depth of cover column would be represented as a 1 and anything in between 0.6 to 5.0 would be represented as a 2, and anything greater than 5.1 would be a 3 in the score column. This is the expression I have used:

CASE
  WHEN  "Depth of cover" <=0.5 THEN 1
  WHEN  "Depth of cover" >=0.6 <=5.0 THEN 2 
  WHEN  "Depth of cover">=5.1 THEN 3 End

I can get the 1 and 3 values to work but not 2. I know I have the expression wrong at this point because I'm doing a range rather than a less than or greater.

Following on from this if I wanted to change the 1 to a High 2 to medium and 3 to Low how would I do this as I get Column 'High' not found.

1 comments

@J. Monticolo 2019-02-06 14:22:17

Try this (I correct bounds too) :

CASE
 WHEN "Depth of cover" <= 0.5 THEN 1
 WHEN "Depth of cover" > 0.5 AND "Depth of cover" <= 5.0 THEN 2 
 WHEN "Depth of cover" > 5.0 THEN 3
END

For the second part, create a string field and update it with :

CASE
 WHEN "Depth of cover" <= 0.5 THEN 'High'
 WHEN "Depth of cover" > 0.5 AND "Depth of cover" <= 5.0 THEN 'Medium'
 WHEN "Depth of cover" > 5.0 THEN 'Low'
END

Related Questions

Sponsored Content

1 Answered Questions

Dividing up vector grid and scoring cells using QGIS?

  • 2019-08-03 11:26:03
  • Anna
  • 30 View
  • 1 Score
  • 1 Answer
  • Tags:   qgis vector-grid

2 Answered Questions

[SOLVED] How to convert several 'point' data to 'line' data?

1 Answered Questions

Using ArcGIS Field Calculator to change text to digit?

1 Answered Questions

[SOLVED] Change simple symbol color by expression

  • 2017-12-05 14:27:20
  • user110549
  • 985 View
  • 1 Score
  • 1 Answer
  • Tags:   qgis

1 Answered Questions

[SOLVED] QGIS relation_aggregate, how does this work?

1 Answered Questions

1 Answered Questions

2 Answered Questions

1 Answered Questions

[SOLVED] How to calculate distances in QGIS field calculator?

1 Answered Questions

Sponsored Content