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 @@ fistools - 0.2.0 + 1.0.0 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 @@ fistools - 0.2.0 + 1.0.0 @@ -38,7 +38,6 @@

Contributor Covenant Code of Conduct

-

Our Pledge

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 @@

EnforcementEnforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:

-

1. Correction

+

1. Correction

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.

-

2. Warning

+

2. Warning

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.

-

3. Temporary Ban

+

3. Temporary 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.

-

4. Permanent Ban

+

4. 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.

diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index f22641b..a8944dc 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -17,7 +17,7 @@ fistools - 0.2.0 + 1.0.0
diff --git a/docs/LICENSE.html b/docs/LICENSE.html index 4e20910..43feeb6 100644 --- a/docs/LICENSE.html +++ b/docs/LICENSE.html @@ -17,7 +17,7 @@ fistools - 0.2.0 + 1.0.0
@@ -38,7 +38,6 @@

MIT License

-

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 @@ fistools - 0.2.0 + 1.0.0
@@ -66,13 +66,13 @@

Citation

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 @@ fistools - 0.2.0 + 1.0.0 @@ -57,8 +57,7 @@
- -
+

Repo containing widely used data & functions of the FIS team

@@ -71,7 +70,7 @@

installatie

what can I do with this package?

-

A list of functions & datasets can be found in the reference manual

+

A list of functions & datasets can be found in the reference page

@@ -114,7 +113,7 @@

Dev status

diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index a69126e..b2e5abd 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -1,5 +1,5 @@ -pandoc: 3.1.11 +pandoc: 2.9.2.1 pkgdown: 2.1.0 pkgdown_sha: ~ articles: {} -last_built: 2024-07-18T12:57Z +last_built: 2024-07-22T13:09Z diff --git a/docs/reference/CRS_extracter.html b/docs/reference/CRS_extracter.html new file mode 100644 index 0000000..e47e2a6 --- /dev/null +++ b/docs/reference/CRS_extracter.html @@ -0,0 +1,127 @@ + +CRS_extracter — CRS_extracter • fistools + + +
+
+ + + +
+
+ + +
+

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)
+
+ +
+

Arguments

+ + +
CRS
+

A character string with the name of the CRS

+ + +
EPSG
+

A logical indicating whether the output should be in EPSG format

+ +
+
+

Value

+

A CRS object

+
+
+

Author

+

Sander Devisscher

+
+ +
+

Examples

+
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)
+} # }
+
+
+
+
+ +
+ + +
+ + + + + + + + diff --git a/docs/reference/UUID_List.html b/docs/reference/UUID_List.html index 83139da..b2b13e3 100644 --- a/docs/reference/UUID_List.html +++ b/docs/reference/UUID_List.html @@ -17,7 +17,7 @@ fistools - 0.2.0 + 1.0.0 diff --git a/docs/reference/apply_grtsdb.html b/docs/reference/apply_grtsdb.html index 00ae8de..d4bc41e 100644 --- a/docs/reference/apply_grtsdb.html +++ b/docs/reference/apply_grtsdb.html @@ -18,7 +18,7 @@ fistools - 0.2.0 + 1.0.0 @@ -41,7 +41,7 @@

apply grtsdb

-

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.

@@ -87,7 +87,7 @@

Author

Examples

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 @@ fistools - 0.2.0 + 1.0.0
diff --git a/docs/reference/calculate_polygon_centroid.html b/docs/reference/calculate_polygon_centroid.html new file mode 100644 index 0000000..9eaf80b --- /dev/null +++ b/docs/reference/calculate_polygon_centroid.html @@ -0,0 +1,128 @@ + +Calculate the centroid of a polygon — calculate_polygon_centroid • fistools + + +
+
+ + + +
+
+ + +
+

This function calculates the centroid of a polygon and returns the latitude, longitude and uncertainty of the centroid.

+
+ +
+
calculate_polygon_centroid(sf_df, id)
+
+ +
+

Arguments

+ + +
sf_df
+

A sf object with polygons

+ + +
id
+

A character string with the name of the column containing the unique identifier

+ +
+
+

Value

+

A data frame with the unique identifier, latitude, longitude and uncertainty of the centroid

+
+
+

Author

+

Sander Devisscher

+
+ +
+

Examples

+
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)
+} # }
+
+
+
+
+ +
+ + +
+ +
+

Site built with pkgdown 2.1.0.

+
+ +
+ + + + + + + + diff --git a/docs/reference/check.html b/docs/reference/check.html index 103d0a3..462a2ac 100644 --- a/docs/reference/check.html +++ b/docs/reference/check.html @@ -17,7 +17,7 @@ fistools - 0.2.0 + 1.0.0 diff --git a/docs/reference/cleanup_sqlite.html b/docs/reference/cleanup_sqlite.html index 1348793..ec02add 100644 --- a/docs/reference/cleanup_sqlite.html +++ b/docs/reference/cleanup_sqlite.html @@ -17,7 +17,7 @@ fistools - 0.2.0 + 1.0.0 diff --git a/docs/reference/colcompare.html b/docs/reference/colcompare.html index 5c04a34..9424bf7 100644 --- a/docs/reference/colcompare.html +++ b/docs/reference/colcompare.html @@ -17,7 +17,7 @@ fistools - 0.2.0 + 1.0.0 diff --git a/docs/reference/collect_osm_features.html b/docs/reference/collect_osm_features.html index b8b9cc6..62f1d8e 100644 --- a/docs/reference/collect_osm_features.html +++ b/docs/reference/collect_osm_features.html @@ -23,7 +23,7 @@ fistools - 0.2.0 + 1.0.0 @@ -110,8 +110,8 @@

Examples

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 @@ fistools - 0.2.0 + 1.0.0
diff --git a/docs/reference/download_gdrive_if_missing.html b/docs/reference/download_gdrive_if_missing.html index 6a05856..5284b89 100644 --- a/docs/reference/download_gdrive_if_missing.html +++ b/docs/reference/download_gdrive_if_missing.html @@ -19,7 +19,7 @@ fistools - 0.2.0 + 1.0.0 diff --git a/docs/reference/download_seq_media.html b/docs/reference/download_seq_media.html index cea1132..be95433 100644 --- a/docs/reference/download_seq_media.html +++ b/docs/reference/download_seq_media.html @@ -18,7 +18,7 @@ fistools - 0.2.0 + 1.0.0 diff --git a/docs/reference/drg_example.html b/docs/reference/drg_example.html index 2efc33a..a9def99 100644 --- a/docs/reference/drg_example.html +++ b/docs/reference/drg_example.html @@ -17,7 +17,7 @@ fistools - 0.2.0 + 1.0.0 diff --git a/docs/reference/index.html b/docs/reference/index.html index 9b8007d..e98a601 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -17,7 +17,7 @@ fistools - 0.2.0 + 1.0.0 @@ -42,6 +42,14 @@

All functions

+

CRS_extracter()

+ +

CRS_extracter

+ +

UUID_List()

+ +

UUID list generator

+

apply_grtsdb()

apply grtsdb

@@ -49,6 +57,10 @@

All functions boswachterijen

Boswachterijen

+ +

calculate_polygon_centroid()

+ +

Calculate the centroid of a polygon

check()

@@ -81,14 +93,18 @@

All functions drg_example

drg_example

+ +

install_sp()

+ +

install sp

label_converter()

label converter

-

UUID_List()

+

lib_crs

-

UUID list generator

+

Lib CRS

@@ -49,7 +49,7 @@

label converter

id_column, labelnummer_column, soort_column, - labeltype_column, + labeltype_column = NULL, jaar_column, output_style = "eloket" )
@@ -84,16 +84,16 @@

Arguments

output_style
-

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".

Value

-

a dataframe containing 2 columns id & label

+

a dataframe containing 2 columns: id & label

Details

-

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'.

@@ -131,10 +131,11 @@

Examples

labels <- label_converter(df, "id", "labelnummer", "soort", "REEKITS", 2020, "eloket") # provide a dataframe with mixed labelnummers & labeltype & hardcode soort & jaar -df <- labels %>% - left_join(df %>% select(-labelnummer), by = "id") %>% - add_row(id = setdiff(1:1000, labels$id)) %>% - mutate(labelnummer = ifelse(is.na(labelnummer), sample(1:1000, 1000, replace = TRUE), labelnummer)) %>% +## remark: run the function once prior to testing +df <- labels %>% + left_join(df %>% select(-labelnummer), by = "id") %>% + add_row(id = setdiff(1:1000, labels$id)) %>% + mutate(labelnummer = ifelse(is.na(labelnummer), sample(1:1000, 1000, replace = TRUE), labelnummer)) %>% mutate(labeltype = ifelse(is.na(labeltype), sample(c("REEKITS", "REEGEIT", "REEBOK", NA), 1000, replace = TRUE), labeltype)) labels <- label_converter(df, "id", "labelnummer", "REE", "labeltype", 2020, "eloket") diff --git a/docs/reference/lib_crs.html b/docs/reference/lib_crs.html new file mode 100644 index 0000000..0371ee5 --- /dev/null +++ b/docs/reference/lib_crs.html @@ -0,0 +1,92 @@ + +Lib CRS — lib_crs • fistools + + +
+
+ + + +
+
+ + +
+

Library of commonly used coordinate reference system (CRS) codes

+
+ +
+
lib_crs
+
+ +
+

Format

+

A named list with the following elements:

CRS_Naam
+

ID of the CRS

+ +
Proj4s
+

Javascript Object Notation (JSON) of the CRS

+ +
ESPG
+

EPSG code of the CRS

+ + +
+ + +
+ +
+ + +
+ +
+

Site built with pkgdown 2.1.0.

+
+ +
+ + + + + + + + diff --git a/docs/sitemap.xml b/docs/sitemap.xml index 7fd83e8..5af15f5 100644 --- a/docs/sitemap.xml +++ b/docs/sitemap.xml @@ -1,12 +1,15 @@ /404.html -/authors.html /CODE_OF_CONDUCT.html -/index.html /LICENSE-text.html /LICENSE.html +/authors.html +/index.html +/reference/CRS_extracter.html +/reference/UUID_List.html /reference/apply_grtsdb.html /reference/boswachterijen.html +/reference/calculate_polygon_centroid.html /reference/check.html /reference/cleanup_sqlite.html /reference/colcompare.html @@ -16,7 +19,8 @@ /reference/download_seq_media.html /reference/drg_example.html /reference/index.html +/reference/install_sp.html /reference/label_converter.html -/reference/UUID_List.html +/reference/lib_crs.html