Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.4k views
in Technique[技术] by (71.8m points)

r - Quantifiying changes in landcover classes from raster into tabular form

I'm trying to calculate habitat changes through the difference in pland values between 2010 and 2019.

Pland is calculated like so:

enter image description here

PLAND is equal to the sum of areas (m2) of all patches corresponding the patch type (aij), divided by the total landscape area (m2), and multiplied by 100 (to convert into percentages).

I know that I can gather the difference between two rasters likeso:

r_change <- r1 - r

However, they will maintain their original landcover classes which are named like this:

lc_name = c("pland_00_water", 
            "pland_01_evergreen_needleleaf", 
            "pland_02_evergreen_broadleaf", 
            "pland_03_deciduous_needleleaf", 
            "pland_04_deciduous_broadleaf", 
            "pland_05_mixed_forest",
            "pland_06_closed_shrubland", 
            "pland_07_open_shrubland", 
            "pland_08_woody_savanna", 
            "pland_09_savanna", 
            "pland_10_grassland", 
            "pland_11_wetland", 
            "pland_12_cropland", 
            "pland_13_urban", 
            "pland_14_mosiac", 
            "pland_15_barren"))

This new raster will have negative values to suggest those habitats that have decreased. However, is there a way to rename these changes similar to this table:

Landcover class changes Percentage change
grassland_to_cropland 4%
grassland_to_barren 2%
barren_to_grassland 1%

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...