landscapemetrics
Landscape Metrics for Categorical Map Patterns 🗺️ in R
Science Score: 49.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 5 DOI reference(s) in README -
○Academic publication links
-
✓Committers with academic emails
2 of 15 committers (13.3%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (19.4%) to scientific vocabulary
Keywords
landscape-ecology
landscape-metrics
r
raster
spatial
Keywords from Contributors
geo
agent-based-modeling
individual-based-modelling
netlogo
neutral-landscape-model
geography
geospatial-data
spatial-analysis
point-pattern-analysis
habitat-association
Last synced: 4 months ago
·
JSON representation
Repository
Landscape Metrics for Categorical Map Patterns 🗺️ in R
Basic Info
- Host: GitHub
- Owner: r-spatialecology
- License: gpl-3.0
- Language: R
- Default Branch: main
- Homepage: https://r-spatialecology.github.io/landscapemetrics
- Size: 75.6 MB
Statistics
- Stars: 250
- Watchers: 13
- Forks: 46
- Open Issues: 8
- Releases: 30
Topics
landscape-ecology
landscape-metrics
r
raster
spatial
Created almost 8 years ago
· Last pushed 8 months ago
Metadata Files
Readme
Changelog
Contributing
License
Code of conduct
Codemeta
README.Rmd
---
output:
github_document:
html_preview: false
---
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# landscapemetrics
README last updated: `r Sys.Date()`
| CI | Development | CRAN | License |
|----|-------------|------|---------|
| [](https://github.com/r-spatialecology/landscapemetrics/actions/workflows/R-CMD-check.yaml) | [](https://lifecycle.r-lib.org/articles/stages.html) | [](https://cran.r-project.org/package=landscapemetrics) | [](https://www.gnu.org/licenses/gpl-3.0) |
| [](https://app.codecov.io/gh/r-spatialecology/landscapemetrics) | [](https://www.repostatus.org/) | [](https://cran.r-project.org/package=landscapemetrics) | [](https://doi.org/10.1111/ecog.04617) |
> Starting from v2.0.0, **landscapemetrics** uses `terra` and `sf` internally. More information about the `terra` package can be found here: .
## Overview
**landscapemetrics** is a `R` package for calculating landscape metrics for categorical landscape patterns in a tidy workflow. The package can be used as a drop-in replacement for FRAGSTATS (McGarigal *et al.* 2023), as it offers a reproducible workflow for landscape analysis in a single environment. It also allows for calculations of four theoretical metrics of landscape complexity: a marginal entropy, a conditional entropy, a joint entropy, and a mutual information (Nowosad and Stepinski 2019).
**landscapemetrics** supports **terra**, and **stars** and takes `SpatRaster` or `stars` spatial objects as input arguments. Every function can be used in a piped workflow, as it always takes the data as the first argument and returns a `tibble`.
#### Citation
To cite **landscapemetrics** or acknowledge its use, please cite the following Software note, substituting the version of the application that you used for 'v0.0':
Hesselbarth, M.H.K., Sciaini, M., With, K.A., Wiegand, K., Nowosad, J. 2019.
landscapemetrics: an open‐source R tool to calculate landscape metrics. Ecography, 42: 1648-1657 (v0.0).
For more information see [Publication record](https://r-spatialecology.github.io/landscapemetrics/articles/articles/publication_record.html) vignette. The get a BibTex entry, please use `citation("landscapemetrics")`.
## Installation
There are several ways to install **landscapemetrics**:
```{r, eval = FALSE, echo = TRUE}
# Get the stable version from CRAN
install.packages("landscapemetrics")
# Alternatively, you can install the development version from Github
# install.packages("remotes")
remotes::install_github("r-spatialecology/landscapemetrics")
```
#### Announcement
Due to an improved connected-component labelling algorithm (**landscapemetrics** v1.4 and higher), patches are labeled in a different order than before and therefore different patch IDs might be used compared to previous versions. However, results for all metrics are identical.
## Using landscapemetrics
The resolution of a raster cell has to be in **meters**, as the package converts units internally and returns results in either meters, square meters or hectares. Before using **landscapemetrics**, be sure to check your raster (see `check_landscape()`).
All functions in **landscapemetrics** start with `lsm_` (for **l**and**s**cape **m**etrics). The second part of the name specifies the level (patch - `p`, class - `c` or landscape - `l`). The last part of the function name is the abbreviation of the corresponding metric (e.g. `enn` for the euclidean nearest-neighbor distance):
```
# general structure
lsm_"level"_"metric"
# Patch level
## lsm_p_"metric"
lsm_p_enn()
# Class level
## lsm_c_"metric"
lsm_c_enn()
# Landscape level
## lsm_p_"metric"
lsm_l_enn()
```
All functions return an identical structured tibble:
| layer | level | class | id | metric | value |
| ----- | --------- | ----- | -- | ---------------- | ----- |
| 1 | patch | 1 | 1 | landscape metric | x |
| 1 | class | 1 | NA | landscape metric | x |
| 1 | landscape | NA | NA | landscape metric | x |
### Using metric functions
Every function follows the same implementation design, so the usage is quite straightforward:
```{r, message = FALSE, warning = FALSE, fig.align = "center", out.width = "75%"}
library(landscapemetrics)
library(terra)
# internal data needs to be read
landscape <- terra::rast(landscapemetrics::landscape)
# landscape raster
plot(landscape)
# calculate for example the Euclidean nearest-neighbor distance on patch level
lsm_p_enn(landscape)
# calculate the total area and total class edge length
lsm_l_ta(landscape)
lsm_c_te(landscape)
```
There is also a wrapper around every metric in the package to quickly calculate a bunch of metrics:
```{r, message = FALSE}
# calculate all metrics on patch level
calculate_lsm(landscape, level = "patch")
```
### Utility functions
**landscapemetrics** further provides several visualization functions, e.g. show all labeled patches or the core area of all patches. All visualization functions start with the prefix `show_` (e.g. `show_cores()`).
Important building blocks of the package are exported to help facilitate analysis or the development of new metrics. They all start with the prefix `get_`. All of them are implemented with Rcpp and have either memory or performance advantages compared to raster functions.
For more details, see the `vignette("utility")`.
### Contributing
One of the major motivations behind **landscapemetrics** is the idea to provide an open-source code collection of landscape metrics. This includes, besides bug reports, especially the idea to include new metrics and functions. Therefore, in case you want to suggest new metrics or functions and in the best case even contribute code, we warmly welcome to do so\! For more information see [CONTRIBUTING](CONTRIBUTING.md).
Maintainers and contributors must follow this repository’s [CODE OF CONDUCT](CODE_OF_CONDUCT.md).
### References
McGarigal K., SA Cushman, and E Ene. 2023. FRAGSTATS v4: Spatial Pattern Analysis Program for Categorical Maps. Computer software program produced by the authors; available at the following web site:
Nowosad J., TF Stepinski. 2019. Information theory as a consistent framework for quantification and classification of landscape patterns. https://doi.org/10.1007/s10980-019-00830-x
Owner
- Name: r-spatialecology
- Login: r-spatialecology
- Kind: organization
- Repositories: 9
- Profile: https://github.com/r-spatialecology
CodeMeta (codemeta.json)
{
"@context": "https://doi.org/10.5063/schema/codemeta-2.0",
"@type": "SoftwareSourceCode",
"identifier": "landscapemetrics",
"description": "Calculates landscape metrics for categorical landscape patterns in a tidy workflow. 'landscapemetrics' reimplements the most common metrics from 'FRAGSTATS' (<https://www.fragstats.org/>) and new ones from the current literature on landscape metrics. This package supports 'terra' SpatRaster objects as input arguments. It further provides utility functions to visualize patches, select metrics and building blocks to develop new metrics.",
"name": "landscapemetrics: Landscape Metrics for Categorical Map Patterns",
"codeRepository": "https://r-spatialecology.github.io/landscapemetrics/",
"issueTracker": "https://github.com/r-spatialecology/landscapemetrics/issues",
"license": "https://spdx.org/licenses/GPL-3.0",
"version": "2.2.2",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
"url": "https://r-project.org"
},
"runtimePlatform": "R version 4.5.1 (2025-06-13)",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"author": [
{
"@type": "Person",
"givenName": "Maximilian H.K.",
"familyName": "Hesselbarth",
"email": "mhk.hesselbarth@gmail.com",
"@id": "https://orcid.org/0000-0003-1125-9918"
},
{
"@type": "Person",
"givenName": "Marco",
"familyName": "Sciaini",
"email": "sciaini.marco@gmail.com",
"@id": "https://orcid.org/0000-0002-3042-5435"
},
{
"@type": "Person",
"givenName": "Jakub",
"familyName": "Nowosad",
"email": "nowosad.jakub@gmail.com",
"@id": "https://orcid.org/0000-0002-1057-3721"
},
{
"@type": "Person",
"givenName": "Sebastian",
"familyName": "Hanss",
"@id": "https://orcid.org/0000-0002-3990-4897"
}
],
"contributor": [
{
"@type": "Person",
"givenName": "Laura J.",
"familyName": "Graham"
},
{
"@type": "Person",
"givenName": "Jeffrey",
"familyName": "Hollister"
},
{
"@type": "Person",
"givenName": "Kimberly A.",
"familyName": "With"
},
{
"@type": "Person",
"givenName": "Florian",
"familyName": "Priv"
},
{
"@type": "Organization",
"name": "Project Nayuki"
},
{
"@type": "Person",
"givenName": "Matt",
"familyName": "Strimas-Mackey"
}
],
"maintainer": [
{
"@type": "Person",
"givenName": "Maximilian H.K.",
"familyName": "Hesselbarth",
"email": "mhk.hesselbarth@gmail.com",
"@id": "https://orcid.org/0000-0003-1125-9918"
}
],
"softwareSuggestions": [
{
"@type": "SoftwareApplication",
"identifier": "covr",
"name": "covr",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=covr"
},
{
"@type": "SoftwareApplication",
"identifier": "dplyr",
"name": "dplyr",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=dplyr"
},
{
"@type": "SoftwareApplication",
"identifier": "knitr",
"name": "knitr",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=knitr"
},
{
"@type": "SoftwareApplication",
"identifier": "raster",
"name": "raster",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=raster"
},
{
"@type": "SoftwareApplication",
"identifier": "rmarkdown",
"name": "rmarkdown",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=rmarkdown"
},
{
"@type": "SoftwareApplication",
"identifier": "sf",
"name": "sf",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=sf"
},
{
"@type": "SoftwareApplication",
"identifier": "sp",
"name": "sp",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=sp"
},
{
"@type": "SoftwareApplication",
"identifier": "stars",
"name": "stars",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=stars"
},
{
"@type": "SoftwareApplication",
"identifier": "stringr",
"name": "stringr",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=stringr"
},
{
"@type": "SoftwareApplication",
"identifier": "testthat",
"name": "testthat",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=testthat"
},
{
"@type": "SoftwareApplication",
"identifier": "tidyr",
"name": "tidyr",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=tidyr"
}
],
"softwareRequirements": {
"1": {
"@type": "SoftwareApplication",
"identifier": "R",
"name": "R",
"version": ">= 3.6"
},
"2": {
"@type": "SoftwareApplication",
"identifier": "cli",
"name": "cli",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=cli"
},
"3": {
"@type": "SoftwareApplication",
"identifier": "ggplot2",
"name": "ggplot2",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=ggplot2"
},
"4": {
"@type": "SoftwareApplication",
"identifier": "methods",
"name": "methods"
},
"5": {
"@type": "SoftwareApplication",
"identifier": "Rcpp",
"name": "Rcpp",
"version": ">= 0.11.0",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=Rcpp"
},
"6": {
"@type": "SoftwareApplication",
"identifier": "stats",
"name": "stats"
},
"7": {
"@type": "SoftwareApplication",
"identifier": "terra",
"name": "terra",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=terra"
},
"8": {
"@type": "SoftwareApplication",
"identifier": "tibble",
"name": "tibble",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=tibble"
},
"SystemRequirements": null
},
"fileSize": "1761.287KB",
"citation": [
{
"@type": "ScholarlyArticle",
"datePublished": "2019",
"author": [
{
"@type": "Person",
"givenName": [
"Maximilian",
"H.K."
],
"familyName": "Hesselbarth"
},
{
"@type": "Person",
"givenName": "Marco",
"familyName": "Sciaini"
},
{
"@type": "Person",
"givenName": [
"Kimberly",
"A."
],
"familyName": "With"
},
{
"@type": "Person",
"givenName": "Kerstin",
"familyName": "Wiegand"
},
{
"@type": "Person",
"givenName": "Jakub",
"familyName": "Nowosad"
}
],
"name": "landscapemetrics: an open-source R tool to calculate landscape metrics",
"pagination": "1648-1657",
"isPartOf": {
"@type": "PublicationIssue",
"datePublished": "2019",
"isPartOf": {
"@type": [
"PublicationVolume",
"Periodical"
],
"volumeNumber": "42",
"name": "Ecography"
}
}
}
]
}
GitHub Events
Total
- Create event: 3
- Release event: 1
- Issues event: 12
- Watch event: 16
- Delete event: 2
- Issue comment event: 21
- Push event: 25
- Pull request event: 5
- Fork event: 1
Last Year
- Create event: 3
- Release event: 1
- Issues event: 12
- Watch event: 16
- Delete event: 2
- Issue comment event: 21
- Push event: 25
- Pull request event: 5
- Fork event: 1
Committers
Last synced: 5 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Maximilian Hesselbarth | m****h@u****e | 921 |
| marco | s****o@g****m | 369 |
| jn | t****i@g****m | 344 |
| Sebastian Hanss | s****n@h****o | 47 |
| GitHub Actions | a****s@g****m | 14 |
| GitHub | n****y@g****m | 5 |
| mhesselbarth | m****h@g****n | 3 |
| DavZim | d****n@h****e | 2 |
| Guillermo Ponce | g****e@a****t | 2 |
| kalab-oto | k****o@g****m | 2 |
| laurajanegraham | l****m@g****m | 2 |
| Darío Hereñú | m****a@g****m | 1 |
| Matt Strimas-Mackey | m****s@g****m | 1 |
| Matthias Grenié | m****e@e****r | 1 |
| jsta | s****2@m****u | 1 |
Committer Domains (Top 20 + Academic)
github.com: 2
msu.edu: 1
ens-lyon.fr: 1
arstucson.net: 1
hotmail.de: 1
gmail.con: 1
hanss.info: 1
uni-goettingen.de: 1
Issues and Pull Requests
Last synced: 4 months ago
All Time
- Total issues: 223
- Total pull requests: 122
- Average time to close issues: 4 months
- Average time to close pull requests: 4 days
- Total issue authors: 83
- Total pull request authors: 12
- Average comments per issue: 5.53
- Average comments per pull request: 1.13
- Merged pull requests: 114
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 7
- Pull requests: 7
- Average time to close issues: about 2 months
- Average time to close pull requests: about 6 hours
- Issue authors: 6
- Pull request authors: 2
- Average comments per issue: 2.86
- Average comments per pull request: 0.0
- Merged pull requests: 5
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- mhesselbarth (62)
- Nowosad (35)
- marcosci (21)
- bitbacchus (4)
- ManuelSpinola (4)
- vjjan91 (3)
- fabiolexcastro (3)
- jamiemkass (2)
- rsbivand (2)
- Cumaribo (2)
- deryagulcinubc (2)
- CRyan21 (2)
- vicky-c-c (2)
- jszhao (2)
- filippo-ferrario (2)
Pull Request Authors
- mhesselbarth (80)
- Nowosad (27)
- marcosci (8)
- bitbacchus (7)
- gitter-badger (1)
- kalab-oto (1)
- kant (1)
- jsta (1)
- Rekyt (1)
- gponce-ars (1)
- mstrimas (1)
- DavZim (1)
Top Labels
Issue Labels
enhancement (43)
question (22)
bug (17)
todo (11)
help wanted (11)
future (8)
v2 (3)
good first issue (1)
Pull Request Labels
Packages
- Total packages: 3
-
Total downloads:
- cran 1,557 last-month
- Total docker downloads: 34
-
Total dependent packages: 6
(may contain duplicates) -
Total dependent repositories: 12
(may contain duplicates) - Total versions: 78
- Total maintainers: 1
proxy.golang.org: github.com/r-spatialecology/landscapemetrics
- Documentation: https://pkg.go.dev/github.com/r-spatialecology/landscapemetrics#section-documentation
- License: gpl-3.0
-
Latest release: v2.2.1+incompatible
published 11 months ago
Rankings
Dependent packages count: 5.4%
Average: 5.6%
Dependent repos count: 5.8%
Last synced:
4 months ago
cran.r-project.org: landscapemetrics
Landscape Metrics for Categorical Map Patterns
- Homepage: https://r-spatialecology.github.io/landscapemetrics/
- Documentation: http://cran.r-project.org/web/packages/landscapemetrics/landscapemetrics.pdf
- License: GPL-3
-
Latest release: 2.2.1
published 11 months ago
Rankings
Forks count: 1.9%
Stargazers count: 2.0%
Average: 5.7%
Dependent packages count: 8.0%
Downloads: 8.3%
Dependent repos count: 8.4%
Maintainers (1)
Last synced:
4 months ago
conda-forge.org: r-landscapemetrics
- Homepage: https://r-spatialecology.github.io/landscapemetrics/
- License: GPL-3.0-only
-
Latest release: 1.5.5
published about 3 years ago
Rankings
Stargazers count: 24.2%
Forks count: 27.1%
Dependent repos count: 34.0%
Average: 34.1%
Dependent packages count: 51.2%
Last synced:
4 months ago
Dependencies
.github/workflows/Deploy-pkgdown.yaml
actions
- JamesIves/github-pages-deploy-action 4.1.4 composite
- actions/checkout v3 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/R-CMD-check.yaml
actions
- actions/checkout v3 composite
- r-lib/actions/check-r-package v2 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/Render-README.yaml
actions
- actions/checkout v3 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/Test-coverage.yaml
actions
- actions/checkout v3 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/Write-codemeta.yaml
actions
- actions/checkout v3 composite
- r-lib/actions/setup-r v2 composite
DESCRIPTION
cran
- R >= 3.1 depends
- sf * enhances
- stars * enhances
- Rcpp * imports
- cli * imports
- ggplot2 * imports
- methods * imports
- raster * imports
- sp * imports
- stats * imports
- tibble * imports
- covr * suggests
- dplyr * suggests
- knitr * suggests
- rgeos * suggests
- rmarkdown * suggests
- terra * suggests
- testthat * suggests