rwlts
Support governments in making decisions about the impact of human activities on the environment, planning the use of natural resources, conserving biodiversity and monitoring climate change.
https://github.com/brazil-data-cube/rwlts
Category: Climate Change
Sub Category: Integrated Assessment and Climate Policy
Keywords
earth-observation earth-science geoinformatics geoscience geospatial land-cover r trajectory
Keywords from Contributors
cbers land-use stac land-cover-classification sentinel-2 giscience sits spatiotemporal-asset-catalog
Last synced: about 7 hours ago
JSON representation
Repository metadata
R Client Library for Web Land Trajectory Service
- Host: GitHub
- URL: https://github.com/brazil-data-cube/rwlts
- Owner: brazil-data-cube
- License: other
- Created: 2020-11-12T19:08:53.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-10-05T19:59:19.000Z (over 3 years ago)
- Last Synced: 2024-05-22T11:50:45.743Z (11 months ago)
- Topics: earth-observation, earth-science, geoinformatics, geoscience, geospatial, land-cover, r, trajectory
- Language: R
- Homepage:
- Size: 315 KB
- Stars: 8
- Watchers: 5
- Forks: 3
- Open Issues: 5
- Releases: 0
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
README.Rmd
--- output: github_document editor_options: markdown: wrap: 72 --- ```{r, include = FALSE} knitr::opts_chunk$set( collapse = TRUE, comment = "#>", out.width = "100%", fig.path = "inst/extdata/img/README-" ) library(tibble) ``` # rwltsR Client Library for Web Land Trajectory Service (WLTS) [](https://github.com/brazil-data-cube/rstac/blob/master/LICENSE) [](https://codecov.io/gh/brazil-data-cube/rwlts) [](https://lifecycle.r-lib.org/articles/stages.html) [](https://discord.com/channels/689541907621085198#) # About Information on Land Use and Land Cover (LULC) is essential to support governments in making decisions about the impact of human activities on the environment, planning the use of natural resources, conserving biodiversity and monitoring climate change. Currently, several projects systematically provide information on the dynamics of land use and cover. Well known projects include PRODES, DETER and TerraClass. These projects are developed by INPE and they produce information on land use and coverage used by the Brazilian Government to make public policy decisions. Besides these projects there are other initiatives from universities and space agencies devoted to the creation of national and global maps. Although these projects follow open data policies and provide a rich collection of data, there is still a gap in tools that facilitate the integrated use of these collections. Each project adopts its own land use and land cover classification system, providing different class names and meanings for the elements of these collections. The forms of distribution of project data can be carried out in different ways, through files or web services. In addition, the data has different spatial and temporal resolutions and storage systems (raster or vector). In this context, the **W**eb **L**and **T**rajectory **S**ervice (WLTS) is a service that aims to facilitate the access to these approach consists of using a data model that defines a minimum set of temporal and spatial information to represent different sources and types of data, but with a focus on land use and land cover. WLTS can be used in a variety of applications, such as validating land cover data sets, selecting training samples to support Machine Learning algorithms used in the generation of new classification maps. If you want to know more about WLTS service, please, take a look at its [specification](https://github.com/brazil-data-cube/wlts-spec). ## Installation To install the development version of `rwlts`, run the following commands: ```{R, eval=FALSE} # load necessary libraries library(devtools) devtools::install_github("brazil-data-cube/rwlts") ``` Importing `rwlts` package: ```{R, echo=TRUE, warning=FALSE, message=FALSE} library(rwlts) ``` ## Usage `rwlts` implements the following WLTS operations: ```{R, echo=FALSE} tribble( ~"**WLTS** operations", ~"`rwlts` functions", "`/list_collections`", "`list_collections(URL,)`", "`/describe_collections`", "`describe_collection(URL, collection_id)`", "`/trajectory`", "`get_trajectory(URL, latitude, longitude)`" ) %>% as.data.frame() %>% knitr::kable(format = "markdown") ``` These functions can be used to retrieve information from a WLTS API service. The code bellow creates a `wlts` object and list the available collections of the WLTS API of the Brazil Data Cube project of the Brazilian National Institute for Space Research INPE. ### List Collections The first operation, `list_collections`, retrieves all available collections in WLTS service. ```{R, echo=TRUE} wlts_bdc <- "https://brazildatacube.dpi.inpe.br/wlts/" list_collections(wlts_bdc) ``` ### Describe Collection Each collection returned by the WLTS service can be used for retrieving LULC trajectories. To get information about the collections, we use the `describe_collection` function. This function returns the metadata of a given collection, which includes the description and specific details. The metadata also describes the spatio-temporal extent of the collection. In the code below, we retrieve the metadata from the `deter_amazonia_legal` collection using the `describe_collection` function. ```{R, echo=TRUE} describe_collection(wlts_bdc, "deter_amazonia_legal") ``` ### Trajectory LULC trajectories can be extracted from collections. These LULC trajectories in WLTS services are associated with a point (lat, long) in geographic space. In `rwlts`, we can use the `get_trajectory` function to retrieve trajectories. For example, in the code below, the point `(-54, -12)` trajectory is retrieved from the `mapbiomas_amazonia-v5` collection. ```{r} get_trajectory(wlts_bdc, latitude = -12, longitude = -54, collections = "mapbiomas_amazonia-v5", config = httr::add_headers("x-api-key" = "change-me")) ``` The `get_trajectory` function returns a `list` of class `wlts`. This object contains the `query` and `result` attributes. The `query` attribute stores the query performed to retrieve the data. By default, it will be `NULL`. For this information to be stored, the `query_info = TRUE` parameter is required. For example: ```{r, eval=FALSE} get_trajectory(wlts_bdc, latitude = -12, longitude = -54, collections = "mapbiomas_amazonia-v5", query_info = TRUE, config = httr::add_headers("x-api-key" = "change-me")) ``` The `result` attribute stores the retrieved trajectories. The data is stored in a `tibble` for easy manipulation, which has the columns: - `class`: LULC class; - `collection`: Data Collection; - `date`: Time instants of the trajectory; - `point_id`: ID of the point that was queried. The `point_id` column of the result `tibble` is used in `rwlts` to identify the entry point. This ID is necessary since the `get_trajectory` function can be used with vectors as input. For example, the code below retrieves the trajectory of data from the `mapbiomas_amazonia-v5` collection for two points `(-54, -12)` and `(-54, -11.01)`. ```{r} get_trajectory(wlts_bdc, latitude = c(-12, -11.01), longitude = c(-54, -54), collections = "mapbiomas_amazonia-v5", config = httr::add_headers("x-api-key" = "change-me")) ``` In this case, the point `(-54, -12)` will have `point_id` equal to 1, while `(-54, -11.01)` will have `point_id` equal to 2. In addition to multiple point retrieval, the `get_trajectory` function allows multiple collections to be queried for the composition of the trajectory. To do this, in the `collections` parameter, the collections must be assigned. For example, data from the collections `mapbiomas_amazonia-v5` and `terraclass_amazonia-v2` are retrieved in the code below. ```{r} get_trajectory(wlts_bdc, latitude = c(-12, -11.01), longitude = c(-54, -54), collections = c("mapbiomas_amazonia-v5", "terraclass_amazonia-v2"), config = httr::add_headers("x-api-key" = "change-me")) ``` Finally, the `get_trajectory` function, through the `start_date` and `end_date` parameters, allows you to specify the time intervals used in the trajectory. To exemplify its use, in the code below, trajectories are retrieved for the points `(-54, -12)` and `(-54, -11.01)`, from the `mapbiomas_amazonia-v5` and `terraclass_amazonia-v2` collections in the time interval `[2003-01-01, 2004-01-01]`. ```{r} get_trajectory(wlts_bdc, latitude = c(-12, -11.01), longitude = c(-54, -54), start_date = "2003-01-01", end_date = "2004-01-01", collections = c("mapbiomas_amazonia-v5","terraclass_amazonia-v2"), config = httr::add_headers("x-api-key" = "change-me")) ``` ### Alluvial plot To visualize the trajectories and fully understand their time dynamics, the `rwlts` package implements the Alluvial-based visualization method. To create this plot, use the `plot` function, as shown in the example below: ```{r, fig.width = 9, fig.height = 4} # import data from package data("mt_500_mapbiomas_cerrado") plot(mt_500_mapbiomas_cerrado) ``` Besides, you can fully customize the returned plot. This customization is possible since the `plot` function returns a ggplot2 object. ```{r, fig.width = 10} library(ggplot2) library(ggalluvial) # use to create plot library(cowplot) # use different theme plot(mt_500_mapbiomas_cerrado, show_count = TRUE) + cowplot::theme_minimal_hgrid() + labs(title = "Changes in Primavera do Leste (2004-2014)", x = "Timeline", y = "Number of points", fill = "Class") + theme(legend.position = "bottom", plot.title = element_text(hjust = 0.5)) + scale_fill_manual(values = c("#129912", "#32CD32", "#BDB76B", "#FFD966", "#FFFFB2"), labels = c("Formação Florestal", "Formação Savânica", "Outras Lavouras Temporárias", "Pastagem", "Soja")) ``` > The numbers inside each bar correspond to the quantity of points > extracted in each year. You can see that according to the change of > LULC classes, the quantity of points in each class also changes. # License Copyright (C) 2021 INPE. R client for WLTS is free software; you can redistribute it and/or modify it under the terms of the MIT License; see LICENSE file for more details.
Owner metadata
- Name: Brazil Data Cube
- Login: brazil-data-cube
- Email: [email protected]
- Kind: organization
- Description: Brazil Data Cube is a subproject of the project “Environmental Monitoring of Brazilian Biomes“, funded by the The Amazon Fund in BNDES financial collaboration
- Website: brazildatacube.org
- Location: São José dos Campos, SP, BR
- Twitter:
- Company:
- Icon url: https://avatars.githubusercontent.com/u/51197879?v=4
- Repositories: 48
- Last ynced at: 2023-03-03T01:22:59.195Z
- Profile URL: https://github.com/brazil-data-cube
GitHub Events
Total
Last Year
Committers metadata
Last synced: 5 days ago
Total Commits: 79
Total Committers: 6
Avg Commits per committer: 13.167
Development Distribution Score (DDS): 0.266
Commits in past year: 0
Committers in past year: 0
Avg Commits per committer in past year: 0.0
Development Distribution Score (DDS) in past year: 0.0
Name | Commits | |
---|---|---|
Felipe | l****o@g****m | 58 |
Felipe Menino | f****s@f****r | 11 |
Fabiana Zioti | f****i@h****m | 4 |
Raphael Willian | r****a@g****m | 3 |
repl.it user | r****r@e****m | 2 |
Carlos Alberto Noronha | b****a@l****m | 1 |
Committer domains:
Issue and Pull Request metadata
Last synced: 1 day ago
Total issues: 15
Total pull requests: 10
Average time to close issues: 3 months
Average time to close pull requests: 15 days
Total issue authors: 3
Total pull request authors: 4
Average comments per issue: 0.2
Average comments per pull request: 0.2
Merged pull request: 9
Bot issues: 0
Bot pull requests: 0
Past year issues: 0
Past year pull requests: 0
Past year average time to close issues: N/A
Past year average time to close pull requests: N/A
Past year issue authors: 0
Past year pull request authors: 0
Past year average comments per issue: 0
Past year average comments per pull request: 0
Past year merged pull request: 0
Past year bot issues: 0
Past year bot pull requests: 0
Top Issue Authors
- OldLipe (11)
- M3nin0 (3)
- souza-eab (1)
Top Pull Request Authors
- OldLipe (6)
- fabianazioti (2)
- raphaelrpl (1)
- M3nin0 (1)
Top Issue Labels
- enhancement (10)
- documentation (5)
Top Pull Request Labels
- documentation (6)
- enhancement (5)
- release (2)
Dependencies
- R >= 3.5.0 depends
- dplyr * imports
- httr * imports
- magrittr * imports
- tibble * imports
- covr * suggests
- ggalluvial * suggests
- ggplot2 * suggests
- testthat * suggests
- vcr * suggests
Score: 4.356708826689592