Skip to main content

High-performance network-constrained spatial point pattern analysis in Python

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fastnsa-0.2.0.tar.gz (1.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fastnsa-0.2.0-py3-none-any.whl (1.3 MB view details)

Uploaded Python 3

File details

Details for the file fastnsa-0.2.0.tar.gz.

File metadata

  • Download URL: fastnsa-0.2.0.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for fastnsa-0.2.0.tar.gz
Algorithm Hash digest
SHA256 6a6d91d164d5bed0f3c88036eb273ea7ff229693a9cba05f9fca93866b4113eb
MD5 9c74352d81138c5b73af0c7a1909618b
BLAKE2b-256 f5075f5b8963a204ad99b6144651b54ee0b2c010124df8500d354539bf3f0cd5

See more details on using hashes here.

File details

Details for the file fastnsa-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: fastnsa-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for fastnsa-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5e4c596c4c19e3ad2bf7a3a7193b3a764926426dbdc81e0775fce98bea51de91
MD5 54362f1e568f79905eb481253360b76f
BLAKE2b-256 f22189e44efd70d4a5eed2fd32ba2c83bc065b5fbad06a5a5cbf3ce0c1a73c4d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page