Skip to content

vm_l_te results #20

@Nowosad

Description

@Nowosad

I created a small example to show the issue: landscape2. When using the landscapemetrics package the value returned by lsm_l_te is 140: it counts all of the outer borders (120) plus the border between two classes (20).

library(terra)
library(landscapemetrics)
data("landscape")
landscape = rast(landscape)
landscape2 = aggregate(landscape, 10, fun = "modal", na.rm = TRUE)

lsm_l_te(landscape2, count_boundary = TRUE)$value
#> [1] 140

plot(landscape2)

Image

On the other hand, the vectormetrics double count the border between these classes, and thus the result is 160 (120 + 20 * 2).

@mhesselbarth -- can you confirmed that the landscapemetrics result/approach is as expected?

library(terra)
library(sf)
library(vectormetrics)
library(landscapemetrics)
data("landscape")
landscape = rast(landscape)
landscape2 = aggregate(landscape, 10, fun = "modal", na.rm = TRUE)
landscape2_v = st_as_sf(as.polygons(landscape2))
landscape2_v = st_cast(landscape2_v, "POLYGON")

vm_l_te(landscape2_v)$value 
#> [1] 160

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions