Spatial Optimization for Regionalization, Facility Location, and Market Analysis

Implements spatial optimization algorithms across several problem families including contiguity-constrained regionalization, discrete facility location, market share analysis, and least-cost corridor and route optimization over raster cost surfaces. Facility location problems also accept user-supplied network travel-time matrices. Uses a 'Rust' backend via 'extendr' for graph and routing algorithms, and the 'HiGHS' solver via the 'highs' package for facility location mixed-integer programs. Method-level references are provided in the documentation of the individual functions.


spopt spopt website

The spopt R package provides R-native implementations of spatial optimization algorithms for regionalization, facility location, route optimization, and corridor routing. Inspired by Python's PySAL spopt, the package brings these algorithms to R users with an sf-first API, a Rust backend for graph and routing algorithms, and the HiGHS solver for facility location.

Install from r-universe:

install.packages('spopt', repos = c('https://walkerke.r-universe.dev', 'https://cloud.r-project.org'))

For developers who need to build from source (requires Rust), see CONTRIBUTING.md.

Read through these vignettes to learn how to use the package:

Support and how to learn more

If you find this project useful in your work and would like to ensure continued development of the package, you can provide support in the following ways:

To stay on top of package updates / new features and to get information about trainings, be sure to sign up for the Walker Data mailing list here.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("spopt")

0.1.2 by Kyle Walker, 5 months ago


https://walker-data.com/spopt-r/, https://github.com/walkerke/spopt-r


Report a bug at https://github.com/walkerke/spopt-r/issues


Browse source code at https://github.com/cran/spopt


Authors: Kyle Walker [aut, cre] , PySAL Developers [cph] (Original Python spopt library)


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports sf, spdep, Matrix, highs

Suggests testthat, terra, dodgr, r5r, knitr, rmarkdown, quarto, tidycensus, tidyverse, mapgl

System requirements: Cargo (Rust's package manager), rustc >= 1.70


See at CRAN