knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

rproj

Lifecycle: experimental R-CMD-check Codecov test coverage

The goal of rproj is to provide a literal wrapper around the PROJ C API. It uses libproj as a standalone copy of PROJ independent of a system installation.

Installation

You can install the development version from R Universe with:

install.packages("rproj", repos = "https://paleolimbot.r-universe.dev")

Example

Create a transform and transform some coordinates:

library(rproj)
pipe <- proj_create_crs_to_crs("OGC:CRS84", "EPSG:3827")
proj_trans(pipe, proj_coord(-64, 45))

You can transform arbitrary R objects using the crs2crs interface:

library(crs2crs)
crs_set_engine(crs_engine_rproj())

library(sf)
nc <- read_sf(system.file("shape/nc.shp", package = "sf"))

nc %>% 
  crs_set_longlat(datum = "NAD27") %>% 
  crs_transform("EPSG:3857")


paleolimbot/rlibproj documentation built on Jan. 21, 2022, 1:03 p.m.