bindings to the liblwgeom library
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.


R bindings to the liblwgeom library

Build Status AppVeyor Build Status Coverage Status CRAN cran checks Downloads

This package provides a few functions that require liblwgeom, including st_geohash, st_make_valid, st_minimum_bounding_circle, st_split, st_subdivide, st_transform_proj (transform through proj, omitting GDAL) and st_as_sfc.TWKB (create sfc from tiny wkb), as well as the geodetic (spherical/ellipsoidal) geometry functions st_geod_area, st_geod_length, st_geod_distance, st_geod_covers, st_geod_azimuth, and st_geod_segmentize.

Installing without liblwgeom preinstalled

lwgeom depends on sf, which has to be installed first. It uses the liblwgeom library. When installing from source, it will compile a shipped (and modified) version of this library when the library is not autodetected. In this case, the GEOS and Proj.4 libraries have to be available.


The lwgeom package on windows compiles the liblwgeom sources shipped with the package, and uses the external dependencies (GEOS, PROJ) from the gdal2 winlib.


If you have liblwgeom installed, but want to install this package using the shipped library, install with

R CMD INSTALL lwgeom --configure-args="--without-liblwgeom"

and check with

R CMD check --install-args="--configure-args=--without-liblwgeom" lwgeom_VERSION.tar.gz

Installing with liblwgeom preinstalled


According to, brew install postgis installs a working liblwgeom. In case of problems, search for brew in the sf issues before opening a new one.


On ubuntu, install the following:

sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update
sudo apt-get install libgdal-dev libgeos-dev libproj-dev libudunits2-dev liblwgeom-dev