FastNSA
FastNSA is a high-performance toolkit for network-constrained spatial analysis, designed for large-scale road networks and massive point datasets. It provides a Python interface backed by a native implementation for efficient spatial indexing and network-based statistical computation.
Installation
FastNSA is distributed via PyPI with prebuilt native backends.
pip install fastnsa
Supported platforms:
-
Linux (x86_64)
-
Python ≥ 3.9
Quick Example
import fastnsa as nsa
# 1. Build a road network from OpenStreetMap
# (internally constructs spatial and network indexes)
net = nsa.Network.from_osm(place="Central Park, NY")
# 2. Load event points and project them onto the network
gdf = nsa.load_points("accidents.csv")
events = nsa.PointEvents(gdf, target_network=net)
# 3. Compute a network-based K-function
results = nsa.network_k_function(
network=net,
points=events,
r_values=[10, 50, 100]
)
print(results)
Spatiotemporal Network K-function
import fastnsa as nsa
import numpy as np
net = nsa.Network.from_osm(place="Central Park, NY")
gdf = nsa.load_points("accidents_with_time.csv", time_col="event_time")
events = nsa.PointEvents(gdf, target_network=net, time_col="event_time")
st_result = nsa.spatiotemporal_network_k_function(
network=net,
points=events,
s_values=np.array([50.0, 100.0, 150.0]),
t_values=np.array([1.0, 3.0, 7.0]),
method="EARTH",
simulations=99,
alpha=0.05,
)
print(st_result.k_obs.shape) # (n_s, n_t)
Design Overview
The Python layer provides:
-
Network construction and I/O
-
Event projection to networks
-
tatistical analysis interfaces
Performance-critical components such as spatial indexing, point-to-network mapping, and distance evaluation are implemented in a native backend and exposed through Python bindings.
License
FastNSA is licensed under the GNU Lesser General Public License v3.0 (LGPL-2.1).
You are free to use this library in proprietary and open-source software, but any modifications to the FastNSA library itself must be released under LGPL.
Metadata
Release files for fastnsa 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fastnsa-0.2.0.tar.gz | 1.3 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fastnsa-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 2.5 MB
Release files / fastnsa-0.2.0.tar.gz
| Download URL | fastnsa-0.2.0.tar.gz |
|---|---|
| Size | 1.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6a6d91d164d5bed0f3c88036eb273ea7ff229693a9cba05f9fca93866b4113eb
|
|
BLAKE2b-256 checksum How to use checksums |
f5075f5b8963a204ad99b6144651b54ee0b2c010124df8500d354539bf3f0cd5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Release files / fastnsa-0.2.0-py3-none-any.whl
| Download URL | fastnsa-0.2.0-py3-none-any.whl |
|---|---|
| Size | 1.3 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5e4c596c4c19e3ad2bf7a3a7193b3a764926426dbdc81e0775fce98bea51de91
|
|
BLAKE2b-256 checksum How to use checksums |
f22189e44efd70d4a5eed2fd32ba2c83bc065b5fbad06a5a5cbf3ce0c1a73c4d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|