A package that provides simple features access for R. Package sf:
data.frame
objects (or tibbles
) that have a geometry
list-columnPOSIXct
) columns, and coordinate
reference system transformations through PROJ.4Install 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("r-spatial/sf")
This Ubunto Bionic 18.04 base
includes a pre-configured R and sf.
Simple Features core libraries are integrated and available to
R.
Installing sf from source works under windows when Rtools is installed. This downloads the system requirements from 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:
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
brew link --force gdal2
after that, you should be able to install sf
as a
source package.
For MacOS Sierra, see these instruction, using kyngchaos frameworks.
For Unix-alikes, GDAL (>= 2.0.0), GEOS (>= 3.3.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.
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.
=
rather than <-
;
don't change indentation; tab stops of 4 spaces are preferred)This project gratefully acknowledges financial support from the