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

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
  • 608 View
  • 1 Score
  • 1 Answer
  • Tags:   qgis

1 Answered Questions

[SOLVED] GeoPackage performance big dataset

  • 2017-02-27 18:19:11
  • tjmgis
  • 544 View
  • 4 Score
  • 1 Answer
  • Tags:   qgis geopackage

1 Answered Questions

1 Answered Questions

2 Answered Questions

1 Answered Questions

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

2 Answered Questions

[SOLVED] Manually Adding a Decimal Field to the Attributes Table

  • 2013-07-29 11:27:16
  • AndyH
  • 4194 View
  • 3 Score
  • 2 Answer
  • Tags:   qgis

Sponsored Content