Simple Features for R


License: Other

Language: R

Keywords: r, spatial

Build Status AppVeyor Build Status Coverage Status License CRAN cran checks Downloads

Simple Features for R

A package that provides simple features access for R. Package sf:

  • provides simple features are data.frames or tibbles with a geometry list-column
  • represents natively in R all 17 simple feature types for all dimensions (XY, XYZ, XYM, XYZM)
  • interfaces to GEOS to support the DE9-IM
  • interfaces to GDAL, supporting all driver options, Date and DateTime (POSIXct) columns, and coordinate reference system transformations through PROJ
  • uses well-known-binary serialisations written in C++/Rcpp for fast I/O with GDAL and GEOS
  • reads from and writes to spatial databases such as PostGIS using DBI
  • is extended by pkg lwgeom for further liblwgeom/PostGIS functions, including spherical geometry functions

(Illustration (c) by Allison Horst)

Blogs, presentations, vignettes, sp-sf wiki


CC 4.0 BY Ryan Garnett


Install either from CRAN with:


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



Installing sf from source works under windows when Rtools is installed. This downloads the system requirements from rwinlib.


The easiest way to install gdal is using Homebrew. Recent version of homebrew include a full-featured up-to-date gdal formula:

brew install pkg-config
brew install gdal

Once gdal is installed, you will be able to install sf package from source in R.

Alternatively these instructions explain how to install gdal using kyngchaos frameworks.


For Unix-alikes, GDAL (>= 2.0.1), GEOS (>= 3.4.0) and Proj.4 (>= 4.8.0) are required.


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 update
sudo apt-get install libudunits2-dev libgdal-dev libgeos-dev libproj-dev 

or install dependencies from source; see e.g. an older travis config file for hints.


The following command installs all required dependencies:

sudo dnf install gdal-devel proj-devel proj-epsg proj-nad geos-devel udunits2-devel


Get gdal, proj and geos from the main repos and udunits from the AUR:

pacman -S gdal proj geos
pacaur/yaourt/whatever -S udunits


To install on Debian, the rocker geospatial Dockerfiles may be helpful. Ubuntu Dockerfiles are found here.

Multiple GDAL, GEOS and/or PROJ versions on your system

In case you use dynamic linking (installation from source) and have multiple versions of these libraries installed (e.g. one from ubuntugis-unstable, another installed from source in /usr/local/lib) then this will in general not work, even when setting LD_LIBRARY_PATH manually. See here for the reason why.


Functions and methods that require liblwgeom, including st_make_valid and all spherical or ellipsoidal metrics (area, distances), have since sf 0.5-5 been moved to their own package, lwgeom, which is also on CRAN.


  • 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 gratefully acknowledges financial support from the

Project Statistics

Sourcerank 16
Repository Size 49.9 MB
Stars 754
Forks 198
Watchers 65
Open issues 23
Dependencies 42
Contributors 56
Tags 15
Last updated
Last pushed

Top Contributors See all

Edzer Pebesma Etienne B. Racine Robin Patrick Schratz Andy Teucher Michael Sumner mark padgham Jakub Nowosad Thomas Lin Pedersen Dan Baston David Hugh-Jones David Hugh-Jones Jeroen Ooms Karl Dunkle Werner Matthieu Shinya Uryu Hiroaki Yutani Daniel Possenriede Sébastien Rochette Kirill Müller

Packages Referencing this Repo

Simple Features for R
Latest release 0.9-5 - Updated - 754 stars

Recent Tags See all

0.9-0 March 25, 2020
v0.6-3 May 18, 2018
v0.6-1_2 March 19, 2018
v0.6-1 March 12, 2018
v0.6-0 January 05, 2018
v0.5-5 October 31, 2017
v0.5-3 July 30, 2017
v0.5-2 July 13, 2017
v0.4-3 May 13, 2017
v0.4-2 May 05, 2017
v0.4-1 March 28, 2017
v0.4-0 March 21, 2017
v0.3-4 February 07, 2017
v0.2-8 January 05, 2017
v0.2-2 October 31, 2016

Something wrong with this page? Make a suggestion

Last synced: 2019-07-05 12:46:51 UTC

Login to resync this repository