makesq: Transform site ID to a shape of a square

Description Usage Arguments Value Examples

View source: R/makesq.R

Description

The function transforms the site ID (that consits of 6 digits) to the SpatialPolygons of squares (with a given sidelength) in Swiss grid projection (old or new) or WGS projection. The latter can be used to plot the points on a leaflet (see examples).

Usage

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

Arguments

coordID

Vector with site coordinates

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

Shapefile (as SpatialPolygons of package sp) of the sampling squares.

Examples

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

TobiasRoth/BDM documentation built on May 30, 2018, 8:02 a.m.