makesq: Transform site ID to a shape of a square

View source: R/makesq.R

makesqR Documentation

Transform site ID to a shape of a square

Description

The function transforms the site ID (that consits of 6 digits and points to the SW corner of the square) to a tibble with class sf and a polygon as a geometry. The polygon is a square with a given sidelength in meter. The projection is eiter a the Swiss projection (old or new) or WGS projection. The latter can be used to plot the points on a leaflet (see examples).

Usage

makesq(coordID, projection = "CH-old", sidelength = 1000)

Arguments

coordID

Vector or tibble with site site-IDs. If a tibble, the column with the site-IDs should be named as "aID_STAO".

projection

What projection should be used for the coordinates. One of

  1. CH-old: Old Swiss-grid

  2. CH-new: New Swiss-grid

  3. WGS: WGS grid (e.g. to be used for leaflets, see example)

sidelength

The sidelength (in m) of the squares.

Value

Tibble of class sf with a geometry that describes the sampling squares.

Examples

require(leaflet)
tmp <- makesq(coordID = c(645260), projection = "WGS")
leaflet() %>%
  addTiles() %>%
  addPolygons(data = tmp)


TobiasRoth/BDM documentation built on June 12, 2024, 7:16 a.m.