FastNSA Python
FastNSA is a native-accelerated Python toolkit for network-constrained spatial point analysis. It provides point-to-network mapping, network kernel density estimation (NKDE), network K-functions, and spatiotemporal network K-functions.
The package has two integration levels:
- A lightweight array API based on NumPy and the native FastNSA library.
- A geospatial API for GeoPandas, Shapely, NetworkX, and OSMnx workflows.
Installation
FastNSA 0.3.1 requires Python 3.9 or newer and NumPy 1.23.5 or newer. Install the package with:
python -m pip install fastnsa
See the installation guide for source builds and version requirements, or the release notes for changes in this version.
Published binary wheels determine the supported operating systems, CPU architectures, and Python versions for each release. If no compatible wheel is available, pip may attempt a source build, which requires CMake and a C++17 compiler.
Install only the optional integrations you need:
python -m pip install "fastnsa[dataframe]" # pandas exports
python -m pip install "fastnsa[xarray]" # ST result DataArray exports
python -m pip install "fastnsa[geo]" # GeoPandas and Shapely workflows
python -m pip install "fastnsa[osm]" # NetworkX and OSMnx workflows
python -m pip install "fastnsa[viz]" # Matplotlib visualizations
python -m pip install "fastnsa[all]" # all optional integrations
Minimal Example
The bundled line dataset is useful for installation checks and examples. It does not require GeoPandas, NetworkX, or OSMnx.
import fastnsa as nsa
network = nsa.make_line_network(length=1000.0)
events = nsa.make_line_events(network, offsets=[100.0, 350.0, 700.0, 900.0])
result = nsa.network_k_function(
network=network,
points=events,
r_values=[50.0, 100.0, 250.0],
method=nsa.KFunctionMethod.STARS,
simulations=5,
random_state=2026,
)
print(result.to_records())
result.save_npz("network_k_result.npz")
restored = nsa.load_result("network_k_result.npz")
events.close()
network.close()
Native resources are context managers, so larger applications can use a deterministic lifecycle:
with nsa.make_line_network() as network:
with nsa.make_line_events(network) as events:
result = nsa.network_k_function(
network=network,
points=events,
r_max=500.0,
r_step=50.0,
)
Geospatial Workflow
With the osm extra installed, a network can be downloaded through OSMnx and event files can be loaded through GeoPandas:
import fastnsa as nsa
network = nsa.Network.from_osm(place="Central Park, New York", network_type="drive")
points = nsa.load_points("events.gpkg", layer="events", time_col="event_time")
events = nsa.PointEvents(points, target_network=network, time_col="event_time")
k_result = nsa.network_k_function(
network=network,
points=events,
r_min=0.0,
r_max=2000.0,
r_step=50.0,
method=nsa.KFunctionMethod.STARS,
simulations=99,
envelope="global",
)
Use a projected coordinate reference system whose map units are metres for distance-based analyses. FastNSA does not interpret degree coordinates as geodesic distances.
Main Features
- Point mapping with R-tree, exact comparison, and approximate comparison.
- NKDE methods including ADA and LION with optional event weights.
- Network K-function methods SPS, NS, and STARS.
- Spatiotemporal methods RQS, SPS, EAR, MTS, and EARTH.
- Pointwise or global Monte Carlo envelopes, reproducible seeds, and p-values.
- CSV, pandas, NPZ, and optional xarray result exports.
- Progress callbacks and cooperative cancellation for host applications.
- Direct NumPy inputs for array-based analysis without geospatial dependencies.
Documentation
- Documentation index
- Installation and deployment
- Quick start
- Data model and preprocessing
- Analysis methods
- Results and persistence
- API reference
- Algorithm references
- Troubleshooting
- 中文使用指南
License
FastNSA is licensed under GNU LGPL v2.1 only. Applications may dynamically link to the library under the LGPL terms. Modifications to the FastNSA library itself must remain available under the applicable LGPL requirements. See the packaged LICENSE file for the complete license text.
Metadata
Release files for fastnsa 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fastnsa-0.3.1.tar.gz | 149.6 kB | With provenance | Details for fastnsa-0.3.1.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| fastnsa-0.3.1-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details for fastnsa-0.3.1-py3-none-win_amd64.whl |
| fastnsa-0.3.1-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl | Python 3 | none | Linux glibc 2.17+ x86-64 | Details for fastnsa-0.3.1-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
| fastnsa-0.3.1-py3-none-macosx_11_0_arm64.whl | Python 3 | none | macOS 11.0+ ARM64 | Details for fastnsa-0.3.1-py3-none-macosx_11_0_arm64.whl |
| fastnsa-0.3.1-py3-none-macosx_10_9_x86_64.whl | Python 3 | none | macOS 10.9+ x86-64 | Details for fastnsa-0.3.1-py3-none-macosx_10_9_x86_64.whl |
Total release size: 838.7 kB
Release files / fastnsa-0.3.1.tar.gz
| Download URL | fastnsa-0.3.1.tar.gz |
|---|---|
| Size | 149.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4639c40e828877cb3b109b29989fec7173bf52fb6620a442a288bfee0e72c6d2
|
|
BLAKE2b-256 checksum How to use checksums |
c87c5f739224e0b29f8ab129dc861f3a154a1e39cd5e9ef46469ff82695801ad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.
Transparency logRelease files / fastnsa-0.3.1-py3-none-win_amd64.whl
| Download URL | fastnsa-0.3.1-py3-none-win_amd64.whl |
|---|---|
| Size | 177.4 kB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
19743387a1b6bf366b2770cabb455bf4e8a111147bf29c7735bd3c397aea1982
|
|
BLAKE2b-256 checksum How to use checksums |
e95a42762398a0949eacdf31ca25d2768fed3abe794564f20fcb23509db5e2db
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.
Transparency logRelease files / fastnsa-0.3.1-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | fastnsa-0.3.1-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 172.6 kB |
| Tags | Linux glibc 2.17+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
dffe5601261df6c35d0278450068543ced9cc4e2beac5d3714b2cc576ba826ce
|
|
BLAKE2b-256 checksum How to use checksums |
9374439957348dd1ca0cc4269de37a90f3fdbe40cf7b71660fb2d1c95c8a1cbd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.
Transparency logRelease files / fastnsa-0.3.1-py3-none-macosx_11_0_arm64.whl
| Download URL | fastnsa-0.3.1-py3-none-macosx_11_0_arm64.whl |
|---|---|
| Size | 159.3 kB |
| Tags | Python 3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
0aebae629bf4f8b3066668b4f131fc24bfb4313d3bc540b86c24e93378dc3148
|
|
BLAKE2b-256 checksum How to use checksums |
1b148751aed5fd64771165dd0e07ee5174075d4d44da284d081c9888ef800b54
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.
Transparency logRelease files / fastnsa-0.3.1-py3-none-macosx_10_9_x86_64.whl
| Download URL | fastnsa-0.3.1-py3-none-macosx_10_9_x86_64.whl |
|---|---|
| Size | 179.8 kB |
| Tags | Python 3 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
9d3bf82ae99b61e0fc016521f66925c481c3067617b621f75dbef22e575d2587
|
|
BLAKE2b-256 checksum How to use checksums |
b09ddfcd08a08daa82863cc58b2c230861c00959e16bef09bbc2a7f42bda712e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.
Transparency logSecurity for fastnsa 0.3.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 5 files in this release have been uploaded with provenance metadata.
Attestation for fastnsa-0.3.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.