README.md

geotidy

Manipulate spatial data tidily. Geotidy provides a selection of spatial functions from the sf package that are adapted to a tidy workflow. It relies on tibbles and dplyr verbs, and forces you to be explicit about the spatial operations you desire. The package is experimental. If you want to learn more about the motivations behind it, see the Motivation section.

Motivation

geotidy does less than sf to make manipulations explicit and compatible with other backends. Explicit means that it won't try to guess which column is a geometry and should receive the operation. It also makes it clear by reading the code, which geometry is impacted. This is done by treating geometry columns just like other tibble columns. sf often hides the geometry column, geotidy treats it just like a regular columns. This also makes it easier to interact with other OGC compliant tools, such as postgis or spark+geomesa.

Example

While sf will guess which column should be buffered:

shp<-sf::st_read("")
st_buffer(shp)

geotidy forces to be explicit and use dplyr verbs

shp %>%
mutate(geometry= st_buffer(geometry))

If you already use dplyr with sf, geotidy should fell natural and remove some of the casting operations. geotidy guarantees that your data will stay tidy from start to finish. By having explicit management of geometry columns, it is easy to track multiple columns.

geotidy also guarantees that the returned values are either scalar, or a vector or a list with the same length than the original geometry and not drop any data without the user consent (looking at you st_cast!).

geotidy is not a fork or a separation from sf. It just adds a constrained layer on top of sf to facilitate a tidy workflow. It is an experiment and is very likely to change.