spatial_access: Compute travel times and spatial access metrics at scale
Compute travel times and spatial access measures at scale (millions of origin-destination pairs in minutes). Travel times for three modes: walking, biking, driving. Spatial access measures: provider-to-people ratio, avg. time to nearest provider, count/attribute sum of nearby providers, weighted access scores and floating catchment areas.
|Tested Operating Systems||Ubuntu, macOS|
Components of spatial_access :
spatial_access has two submodules:
- p2p: Generate many to many matrices with travel times for sets of coordinates. Use
drivenetwork types (import
transitfrom other sources), or get the distance in meters.
- Models: Contains a suite of models for calculating spatial accessibility to amenities.
To use this service as a ReST API, see: https://github.com/GeoDaCenter/spatial_access_api
If you are a Windows user, instructions for installing Ubuntu on a virtual machine are at the bottom of the Readme.
A modern compiler like
brew install spatialindex
sudo apt-get install libspatialindex-dev
sudo apt-get install python-tk
pip3 install spatial_access
See the iPython notebooks in
docs/ for example usage, or https://readthedocs.org/projects/spatial-acccess/ for technical documentation.
Overwriting default configuration values
p2p provides default configuration values for edge weights and node impedence (see spatial_access/configs.py). You can overwrite these as follows:
from spatial_access.p2p import TransitMatrix from spatial_access.Configs import Configs custom_config = Configs() # set fields of custom_cofig tm = TransitMatrix(..., configs=custom_config) # continue with computation
Instructions for building locally (only for developers):
- Additional requirements:
- To regenerate .pyx files, run:
bash cythonize_extension.sh(TravisCI will do this automatically on deployment)
- To install locally, run:
sudo python3 setup.py installfrom spatial_access root directory
- Unit tests require the
pytestpackage. From package root directory, run
python3 -m pytest tests/to run all unit tests.
The package lives at:
When a branch is pulled into Master and builds/passes all unit tests, Travis CI will automatically deploy the build to PyPi.
To update PyPi access credentials, see .travis.yml and follow the instructions at https://docs.travis-ci.com/user/deployment/pypi/ to generate a new encrypted password.
Installing Ubuntu 18 LTS with dependencies from scratch (recommended for Windows users)
- Follow the instructions at this link: https://linus.nci.nih.gov/bdge/installUbuntu.html to set up a virtual machine
sudo apt-get update
sudo add-apt-repository universe
sudo apt-get -y install python3-pip
- Continue with Installation Instructions (above)
Developed by Logan Noel at the University of Chicago's Center for Spatial Data Science (CSDS) with support from the Public Health National Center for Innovations (PHNCI), the University of Chicago, and CSDS.