Skip to contents

splnr_create_polygon() allows you to create a polygon based on longitude and latitude coordinates in your input data.

Usage

splnr_create_polygon(x, cCRS = "EPSG:4326")

Arguments

x

A named vector of lon/lat coordinates from which to make an sf polygon

cCRS

The CRS to use for the polygon

Value

An sf object for the polygon

Examples

splnr_create_polygon(x = dplyr::tibble(x = seq(-50, 50, by = 1), y = 120) %>%
  dplyr::bind_rows(dplyr::tibble(x = 50, y = seq(120, 180, by = 1))) %>%
  dplyr::bind_rows(dplyr::tibble(x = seq(50, -50, by = -1), y = 180)) %>%
  dplyr::bind_rows(dplyr::tibble(x = -50, y = seq(150, 120, by = -1))))