diff --git a/.github/workflows/Build pkgdown site.yaml b/.github/workflows/Build pkgdown site.yaml new file mode 100644 index 0000000..627ab0a --- /dev/null +++ b/.github/workflows/Build pkgdown site.yaml @@ -0,0 +1,68 @@ +name: Build pkgdown site + +on: + pull_request: + branches: + - main + +jobs: + build-site: + runs-on: ${{ matrix.config.os }} + + name: ${{ matrix.config.os }} (${{ matrix.config.r }}) + + strategy: + fail-fast: false + matrix: + config: + - {os: ubuntu-latest, r: 'release'} + + env: + RSPM: ${{ matrix.config.rspm }} + GITHUB_PAT: ${{ secrets.GH_PAT }} + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Setup R + uses: r-lib/actions/setup-r@v2 + with: + r-version: ${{ matrix.config.r }} + http-user-agent: ${{ matrix.config.http-user-agent }} + + - name: Install system dependencies + run: | + sudo apt-get update + sudo apt-get install -y libxml2-dev libssl-dev libcurl4-openssl-dev + sudo apt-get install -y libharfbuzz-dev libfribidi-dev + sudo apt-get install -y pandoc + sudo apt-get install -y libudunits2-dev + sudo apt-get install -y libgeos-dev libproj-dev libgdal-dev + + - name: Install R package dependencies + run: | + install.packages('remotes') + remotes::install_deps(dependencies = TRUE) + install.packages('devtools') + devtools::install_github('inbo/fistools', auth_token = Sys.getenv("GITHUB_PAT")) + shell: Rscript {0} + + - name: Install pkgdown + run: install.packages('pkgdown') + shell: Rscript {0} + + - name: Build pkgdown site + run: pkgdown::build_site() + shell: Rscript {0} + + - name: Commit and push changes + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' + git add -A + git commit -m 'Build pkgdown site [skip ci]' + git pull --rebase origin ${{ github.head_ref }} + git push origin HEAD:${{ github.head_ref }} diff --git a/DESCRIPTION b/DESCRIPTION index 1b01703..11f2e0c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -27,7 +27,6 @@ Imports: progress (>= 1.2.3), googledrive (>= 2.1.1), svDialogs (>= 1.1.0), - utils (>= 4.3.2), uuid (>= 1.2.0), devtools (>= 2.4.5), DBI (>= 1.2.3), diff --git a/docs/404.html b/docs/404.html index c90d912..18cb6df 100644 --- a/docs/404.html +++ b/docs/404.html @@ -32,7 +32,7 @@
diff --git a/docs/CODE_OF_CONDUCT.html b/docs/CODE_OF_CONDUCT.html index caae620..502e663 100644 --- a/docs/CODE_OF_CONDUCT.html +++ b/docs/CODE_OF_CONDUCT.html @@ -17,7 +17,7 @@ @@ -38,7 +38,6 @@We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
@@ -77,22 +76,22 @@Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
Community Impact: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
Consequence: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
Community Impact: A violation through a single incident or series of actions.
Consequence: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
Community Impact: A serious violation of community standards, including sustained inappropriate behavior.
Consequence: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
Community Impact: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
Consequence: A permanent ban from any sort of public interaction within the community.
Copyright (c) 2024 fistools authors
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
diff --git a/docs/authors.html b/docs/authors.html index f25873b..7cdd561 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -17,7 +17,7 @@Devisscher S, Pallemaerts L, Delva S, Cartuyvels E (2024). fistools: Tools & data used for wildlife management & invasive species in Flanders. -R package version 0.2.0. +R package version 1.0.0.
@Manual{, title = {fistools: Tools & data used for wildlife management & invasive species in Flanders}, author = {Sander Devisscher and Lynn Pallemaerts and Soria Delva and Emma Cartuyvels}, year = {2024}, - note = {R package version 0.2.0}, + note = {R package version 1.0.0}, }diff --git a/docs/index.html b/docs/index.html index 24f076d..c5cafca 100644 --- a/docs/index.html +++ b/docs/index.html @@ -33,7 +33,7 @@ @@ -57,8 +57,7 @@
Repo containing widely used data & functions of the FIS team
@@ -71,7 +70,7 @@A list of functions & datasets can be found in the reference manual
+A list of functions & datasets can be found in the reference page
CRS_extracter.Rd
Extracts a coordinate reference system (CRS) from a library of commonly used CRS codes +This also fixes issues with the belge lambert 72 we use. +The EPSG code is 31370, but the proj4string is not the same as the one in the EPSG database.
+CRS_extracter(CRS, EPSG = TRUE)
A CRS object
+if (FALSE) { # \dontrun{
+# Example of how to use the CRS_extracter function
+crs_wgs <- CRS_extracter("WGS", EPSG = FALSE)
+crs_bel <- CRS_extracter("BEL72", EPSG = FALSE)
+
+epsg_wgs <- CRS_extracter("WGS", EPSG = TRUE)
+
+# Example of how to use the CRS_extracter function in combination with the sf & leaflet packages
+library(sf)
+library(tidyverse)
+library(leaflet)
+boswachterijen_df <- boswachterijen$boswachterijen_2024 %>%
+ st_transform(crs_bel) %>%
+ mutate(centroid = st_centroid(geometry)) %>%
+ st_drop_geometry() %>%
+ st_as_sf(sf_column_name = "centroid",
+ crs = crs_bel) %>%
+ st_transform(crs_wgs)
+
+leaflet() %>%
+ addTiles() %>%
+ addPolylines(data = boswachterijen$boswachterijen_2024) %>%
+ addCircles(data = boswachterijen_df, color = "red", radius = 1000)
+} # }
+
+
Applies grtsdb::extract_sample
from inbo/GRTSdb to a custom perimeter. This function installs
+
Applies grtsdb::extract_sample
from inbo/GRTSdb to a custom perimeter. This function installs
GRTSdb if it is missing from your machine.
if (FALSE) { # \dontrun{
# Preparation
-perimeter <- sf::st_as_sf(boswachterijen$boswachterijen_2024) %>%
+perimeter <- sf::st_as_sf(boswachterijen$boswachterijen_2024) %>%
dplyr::filter(Regio == "Taxandria",
Naam == "vacant 4")
@@ -97,12 +97,12 @@ Examples
n = 20,
export_path = ".")
-leaflet::leaflet() %>%
- leaflet::addTiles() %>%
+leaflet::leaflet() %>%
+ leaflet::addTiles() %>%
leaflet::addCircles(data = sample$samples,
- color = "red") %>%
+ color = "red") %>%
leaflet::addPolylines(data = sample$grid,
- color = "blue") %>%
+ color = "blue") %>%
leaflet::addPolylines(data = perimeter,
color = "black")
# Reuse a old sample
@@ -114,12 +114,12 @@ Examples
export_path = ".",
seed = seed)
- leaflet::leaflet() %>%
- leaflet::addTiles() %>%
+ leaflet::leaflet() %>%
+ leaflet::addTiles() %>%
leaflet::addCircles(data = sample$samples,
- color = "red") %>%
+ color = "red") %>%
leaflet::addPolylines(data = sample$grid,
- color = "blue") %>%
+ color = "blue") %>%
leaflet::addPolylines(data = perimeter,
color = "black")
} # }
diff --git a/docs/reference/boswachterijen.html b/docs/reference/boswachterijen.html
index 83b74f9..6fd4d50 100644
--- a/docs/reference/boswachterijen.html
+++ b/docs/reference/boswachterijen.html
@@ -18,7 +18,7 @@
calculate_polygon_centroid.Rd
This function calculates the centroid of a polygon and returns the latitude, longitude and uncertainty of the centroid.
+calculate_polygon_centroid(sf_df, id)
A data frame with the unique identifier, latitude, longitude and uncertainty of the centroid
+if (FALSE) { # \dontrun{
+# Example of how to use the calculate_polygon_centroid function
+# Load the necessary data
+boswachterijen <- boswachterijen$boswachterijen_2024
+
+# add a unique identifier to the sf object
+boswachterijen <- boswachterijen %>%
+dplyr::mutate(UUID = as.character(row_number()))
+
+# Calculate the centroid of the polygons
+centroids_data_final <- calculate_polygon_centroid(sf_df = boswachterijen, id = "UUID")
+
+# Plot the polygons and the centroids
+library(leaflet)
+
+# Sample 1 polygon and 1 centroid to plot using id
+sample_id <- sample(centroids_data_final$UUID, 1)
+
+leaflet() %>%
+ addProviderTiles("CartoDB.Positron") %>%
+ addPolygons(data = boswachterijen %>% dplyr::filter(UUID == sample_id),
+ weight = 1, color = "black", fillOpacity = 0.5) %>%
+ addCircles(data = centroids_data_final %>% dplyr::filter(UUID == sample_id),
+ lat = ~centroidLatitude, lng = ~centroidLongitude, radius = 5,
+ color = "black") %>%
+ addCircles(data = centroids_data_final %>% dplyr::filter(UUID == sample_id),
+ lat = ~centroidLatitude, lng = ~centroidLongitude, radius = ~centroidUncertainty,
+ color = "red", weight = 1)
+} # }
+
+
if (FALSE) { # \dontrun{
# extract the bounding box (WGS84) for the Project
-proj_sf <- st_sfc(st_polygon(list(drg_example$spatial$coordinates[1,,])), crs = 4326)
-proj_bbox <- st_bbox(proj_sf)
+proj_sf <- st_sfc(st_polygon(list(drg_example$spatial$coordinates[1,,])), crs = 4326)
+proj_bbox <- st_bbox(proj_sf)
class(proj_bbox)
# extract selected OSM features
osm <- collect_osm_features(proj_bbox)
@@ -128,15 +128,15 @@ Examples
line_elements = "road")
# calculate the area of each landuse class within the bbox
-landuse <- osm_polygons$osm_polygons %>%
- st_make_valid() %>%
- mutate(area = set_units(st_area(.), "km^2")) %>%
- group_by(landuse) %>%
+landuse <- osm_polygons$osm_polygons %>%
+ st_make_valid() %>%
+ mutate(area = set_units(st_area(.), "km^2")) %>%
+ group_by(landuse) %>%
summarise(area = sum(area))
# plot
## polygons
-(p1 <- ggplot(osm_polygons$osm_polygons %>% filter(!is.na(landuse)) %>% arrange(landuse)) +
+(p1 <- ggplot(osm_polygons$osm_polygons %>% filter(!is.na(landuse)) %>% arrange(landuse)) +
geom_sf(aes(fill = landuse), col = NA) +
scale_fill_manual(values = unique(arrange(osm$osm_polygons, landuse)$osm_fill)) +
theme_void() + theme(legend.position = "right"))
diff --git a/docs/reference/download_dep_media.html b/docs/reference/download_dep_media.html
index 097b395..e1de111 100644
--- a/docs/reference/download_dep_media.html
+++ b/docs/reference/download_dep_media.html
@@ -18,7 +18,7 @@
CRS_extracter
UUID list generator
apply grtsdb
boswachterijen
Boswachterijen
Calculate the centroid of a polygon
drg_example
drg_example
install sp
label converter
UUID list generator
Lib CRS
a charcter string specifiying the output style. Can be "eloket" or "labo". Default is "eloket".
a character string specifying the output style. Can be "eloket" or "labo". Default is "eloket".
a dataframe containing 2 columns id & label
+a dataframe containing 2 columns: id & label
The input dataframe should a least contain a id_column & labelnummer_column +
The input dataframe should at least contain an id_column & labelnummer_column other values can be 'hardcoded'.
lib_crs.Rd
Library of commonly used coordinate reference system (CRS) codes
+lib_crs
A named list with the following elements:
ID of the CRS
Javascript Object Notation (JSON) of the CRS
EPSG code of the CRS