Travis-CI Build Status codecov

Intro and rationale

Support for spatial processing tasks is provided in R by several great packages, spanning from all-purpose packages providing generalized access to the main spatial data classes and corresponding processing methods (e.g., sp and sf, raster and rgdal - providing functions for handling raster and vector spatial data -), to more “specialized” ones meant to allow conducting more specific processing tasks (e.g., geosphere, raster, landsat, MODIStsp), or to provide optimized/improved/easier solutions for methods already provided by the aforementioned general-purpose packages (e.g., velox, mapview) (Curated lists of some very good packages can be found here, here and here).

This huge variability provides advanced R programmers with great flexibility for conducting simple or complex spatial data analyses, by combining functionalities of different packages within custom scripts. At the same time, it may be confusing for less skilled programmers, who may struggle with dealing with multiple packages and don’t know that a certain processing task may be more efficiently conducted by using less-known (and sometimes difficult to find) packages.

In this context, sprawl aims to simplify the execution of some “common” spatial processing tasks (e.g., reading/writing spatial datasets, extracting statistics from large datasets, etc.) by providing a single and (hopefully) simpler access point to functionalities spread in the R packages ecosystem.

Package philosophy

The aforementioned objectives are accomplished in sprawl by:

  1. Providing simple wrappers to common-use functions for reading/writing spatial data and performing common-use operations (e.g., read_vect and write_shape to read/write vector files from/to disk);
  2. Providing optimized functions for performing some frequently used processing tasks, by using custom sprawl functions or exploiting functions provided by less-known packages (e.g., mask_rast, extract_rast));
  3. Optimizing code execution speed by providing under-the-hood support for multi-core processing using for example foreach looping along raster bands or raster::MakeCluster functionality;
  4. Providing custom functions or workflows for performing more complex processing tasks,involving the sequential application of different processing steps (e.g., aggregate_rast);
  5. Simplifying access and further analysis of processing results, by carefully formatting processing outputs to easy to use R objects.
  6. Providing custom functions for visualization of processing results.

Given this aim, sprawl is expected to be a broadly-aimed (and therefore rather “amorphous”) and rapidly-changing package, which functionalities are expected to 1. gradually grow to include additional functions/wrappers, and 2. be sometimes removed/changed as soon as similar or better functionalities start to be provided by different/more focused packages.

Installation

You can install sprawl from git-hub with:

install.packages("devtools")
devtools::install_github("lbusett/sprawl")

Note that, given its scope, sprawl imports functions from several other packages, which need to be installed in your system. Since some of those have quite specific System Requirements, it’s possible that you’ll struggle a bit in installation due to unresolved dependencies. In that case, please have a look at the installation error messages to see which package has problems in installation and try to install it beforehand (consulting its specific CRAN pages or doing a stackoverflow search may help !).

Function Documentation

The main functions available in sprawl are documented here, along with simple usage examples.

Examples of use

Worked-out examples of the more complex sprawl functions and workflows can be found here

Contributing

We are open for contributions/help in improving sprawl and extend its functionalities. If you have a suggestion, you can report it in our issues page, or fork the repository and then make a pull request. (note that we plan to provide some “good-practices” instructions for contributing new functions in the future.)

Authors

sprawl is currently developed and maintained by Lorenzo Busetto and Luigi Ranghetti of CNR-IREA (Institute on Remote Sensing of Environment - National Research Council, Italy - http://www.irea.cnr.it/en/)

Citation

To cite package sprawl in publications use:

Lorenzo Busetto and Luigi Ranghetti (2017). sprawl: Spatial Processing (in) R: Amorphous Wrapper Library. R package version 0.1.0.9000.