2

I have an atribute field listing biomes as text strings. I need to do some processing in another program that requires biome information in a numeric code. TLDR; every 'Tropical Rainforest' needs to become '4'. I'd prefer to do this by having an extra Biome Codes field since I could feed the program an exported CSV.

Is there any way other than manually typing?

1
  • 1
    Do you have a table with the codes?
    – Mayo
    Jul 17, 2022 at 22:32

1 Answer 1

5

Using the Field Calculator, make a new field set to Whole Number as the data type.

To populate it use a version of the following expression:

CASE
   WHEN "biome_name_field" = 'Tropical Rainforest' THEN 4
   WHEN "biome_name_field" = 'Desert' THEN 5
   WHEN "biome_name_field" = 'Tundra' THEN 6
END
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.