A package that provides simple features access for R. Package sf:
- represents natively in R all 17 simple feature types for all dimensions (XY, XYZ, XYM, XYZM)
- uses S3 classes: simple features are
data.frame
objects (ortibbles
) that have a geometry list-column - interfaces to GEOS to support the DE9-IM
- interfaces to GDAL with driver dependent dataset or layer creation options, Date and DateTime (
POSIXct
) columns, and coordinate reference system transformations through PROJ.4 - provides fast I/O with GDAL and GEOS using well-known-binary written in C++/Rcpp
- directly reads from and writes to spatial databases such as PostGIS using DBI
See also:
- package vignettes: first, second, third
- blog posts: first, second, third, fourth
- the original R Consortium ISC proposal, the R Consortium blog post
- UseR! 2016 presentation
Install either from CRAN with:
install.packages("sf")
this will install binary packages on Windows and MacOS, unless you configured R such that it tries to install source packages; in that case, see below.
Install development versions from github with
library(devtools)
install_github("edzer/sfr")
Installing sf from source works under windows when Rtools is installed. This downloads the system requirements from (rwinlib)[https://github.com/rwinlib].
One way to install the dependencies is using sudo
; the other is using homebrew. For the latter,
see e.g. here. Homebrew commands might
be (use at your own risk):
brew unlink gdal
brew tap osgeo/osgeo4mac && brew tap --repair
brew install proj
brew install geos
brew install udunits
brew install gdal2 --with-armadillo --with-complete --with-libkml --with-unsupported
after that, you should be able to install sf
as a source package.
For Unix-alikes, GDAL (>= 2.0.0), GEOS (>= 3.3.0) and Proj.4 (>= 4.8.0) are needed.
To install the dependencies on Ubuntu, either:
- add ubuntugis-unstable to the package repositories:
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get install libgdal-dev libgeos-dev libproj-dev
or
- install from source; see e.g. an older travis config file for hints
- Contributions of all sorts are most welcome, issues and pull requests are the preferred ways of sharing them.
- When contributing pull requests, please adhere to the package style (in package code use
=
rather than<-
; don't change indentation; tab stops of 4 spaces are preferred) - This project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
This project is being realized with financial support from the