snkit - a spatial networks toolkit
/ˈsnɪkɪt/ – sounds like snicket (noun, Northern English) A narrow passage between houses; an alleyway.
Why use snkit?
snkit helps tidy spatial network data.
Say you have some edges and nodes (lines and points, connections and vertices). None of them are quite connected, and there's no explicit data to define which node is at the end of which edge, or which edges are connected.
snkit has methods to:
- add endpoints to each edge
- connect nodes to nearest edges
- split edges at connecting points
- create node and edge ids, and add from_id and to_id to each edge
The output of a snkit data cleaning process might look something like this:
Install system libraries (only tested on Ubuntu):
sudo apt-get install -y libspatialindex-dev libgeos-dev gdal-bin
Or use conda to install major dependencies:
conda install pandas geopandas shapely rtree fiona
Install or upgrade
snkit using pip:
pip install --upgrade snkit
See the demo notebook for a small demonstration.
💯 👍 😊
With five lines of snkit I replaced four or five hundred lines of custom code!
A. Contented Customer (@czor847)
pysal/spaghettihas methods for building graph-theoretic networks and the analysis of network events.
osmnxlets you retrieve, model, analyze, and visualize street networks from OpenStreetMap, including methods to correct and simplify network topology.
MIT License Copyright (c) 2018 Tom Russell and snkit contributors
Initial snkit development was at the Environmental Change Institute, University of Oxford within the EPSRC sponsored MISTRAL programme, as part of the Infrastructure Transition Research Consortium.