Skip to main content

High-performance, embedded spatio-temporal database

Project description

Spatio for Python

High-performance spatial database for Python, powered by Rust.

PyPI Python 3.9+ License: MIT

What is it?

Spatio is an embedded database optimized for tracking moving objects. It uses a specialized Hot/Cold State architecture to provide real-time spatial queries and historical trajectory tracking with minimal overhead.

Quick Start

import spatio

# Open an in-memory database
db = spatio.Spatio.memory()

# Track a moving object
pos = spatio.Point(-74.006, 40.712, z=10.0)
db.upsert("drones", "drone_1", pos, {"status": "active"})

# Find objects within 500 meters
nearby = db.query_radius("drones", pos, radius=500, limit=10)
for object_id, point, metadata, distance in nearby:
    print(f"Found {object_id} at {distance:.1f}m")

core API

Spatio (Local Database)

import spatio

# Creation
db = spatio.Spatio.memory()
db = spatio.Spatio.open("data.db")

# Tracking
db.upsert(namespace, object_id, point, metadata=None)
db.get(namespace, object_id)  # Returns CurrentLocation or None
db.delete(namespace, object_id)

# Proximity Queries
# Returns list of (object_id, point, metadata, distance)
db.query_radius(namespace, center_point, radius, limit=100)
db.query_near(namespace, object_id, radius, limit=100)

# K-Nearest Neighbors
db.knn(namespace, center_point, k)
db.knn_near_object(namespace, object_id, k)

# Volume Queries
db.query_bbox(namespace, min_x, min_y, max_x, max_y, limit=100)
db.query_within_cylinder(namespace, center_point, min_z, max_z, radius, limit=100)
db.query_within_bbox_3d(namespace, min_x, min_y, min_z, max_x, max_y, max_z, limit=100)

# Relative Queries
db.query_bbox_near_object(namespace, object_id, width, height, limit=100)
db.query_cylinder_near_object(namespace, object_id, min_z, max_z, radius, limit=100)

# Trajectories
db.insert_trajectory(namespace, object_id, list_of_temporal_points)
db.query_trajectory(namespace, object_id, start_ts, end_ts, limit=100)

Data Types

Point

spatio.Point(lon, lat, z=None)

  • point.lon, point.lat, point.alt
  • point.distance_to(other_point) -> distance in meters (Haversine)

TemporalPoint

spatio.TemporalPoint(point, timestamp)

  • Used for bulk trajectory ingestion.

Performance Tips

  1. Namespaces: Use namespaces to logically separate different types of objects (e.g., "delivery_trucks", "warehouses").
  2. Object Queries: Use query_near or knn_near_object whenever possible, as they avoid re-passing coordinates and leverage the internal Hot State index directly.

License

MIT - see LICENSE

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

spatio-0.2.10-cp314-cp314-win_amd64.whl (404.1 kB view details)

Uploaded CPython 3.14Windows x86-64

spatio-0.2.10-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (522.9 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64

spatio-0.2.10-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (489.8 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ ARM64

spatio-0.2.10-cp314-cp314-macosx_11_0_arm64.whl (444.6 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

spatio-0.2.10-cp313-cp313-win_amd64.whl (403.8 kB view details)

Uploaded CPython 3.13Windows x86-64

spatio-0.2.10-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (522.5 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

spatio-0.2.10-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (489.6 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

spatio-0.2.10-cp313-cp313-macosx_11_0_arm64.whl (444.1 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

spatio-0.2.10-cp312-cp312-win_amd64.whl (403.7 kB view details)

Uploaded CPython 3.12Windows x86-64

spatio-0.2.10-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (522.7 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

spatio-0.2.10-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (489.6 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

spatio-0.2.10-cp312-cp312-macosx_11_0_arm64.whl (444.0 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

spatio-0.2.10-cp311-cp311-win_amd64.whl (403.1 kB view details)

Uploaded CPython 3.11Windows x86-64

spatio-0.2.10-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (523.1 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

spatio-0.2.10-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (490.2 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

spatio-0.2.10-cp311-cp311-macosx_11_0_arm64.whl (445.0 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

spatio-0.2.10-cp310-cp310-win_amd64.whl (405.4 kB view details)

Uploaded CPython 3.10Windows x86-64

spatio-0.2.10-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (525.4 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

spatio-0.2.10-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (492.7 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

spatio-0.2.10-cp310-cp310-macosx_11_0_arm64.whl (447.6 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

spatio-0.2.10-cp39-cp39-win_amd64.whl (408.0 kB view details)

Uploaded CPython 3.9Windows x86-64

spatio-0.2.10-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (529.2 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

spatio-0.2.10-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (495.9 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ ARM64

spatio-0.2.10-cp39-cp39-macosx_11_0_arm64.whl (450.7 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

Details for the file spatio-0.2.10-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: spatio-0.2.10-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 404.1 kB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for spatio-0.2.10-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 1fc8029a53ed4421f92f61623a15dfca7890618eb8983a4f0dd960a2da053dce
MD5 a21fb76d81362ce27bebd607d3789088
BLAKE2b-256 d7dace6f57341ed590a9b0a1e2da0446aeb544dae301bd9ccb44a8ab88570732

See more details on using hashes here.

File details

Details for the file spatio-0.2.10-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for spatio-0.2.10-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 170c30cb5e57d765f2e880a33e0f0e9870418b715795756a3a91e4c9debc3de5
MD5 11c96c64650b83c35a7193f106c419c1
BLAKE2b-256 768cfd18bfbe720017c56cb3d1dd11acd6f3a5aacf51aa8c285d847ccc5de411

See more details on using hashes here.

File details

Details for the file spatio-0.2.10-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for spatio-0.2.10-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 32d884ce139424489c7b7d94ce73900d01247f6ee7d2d0c20c6465e145e3edcf
MD5 043b203e5dcc950bad569798cd91dfb9
BLAKE2b-256 c43d5db0aad22a13ee3a2a82dbc0471f4c5f2cb1fa20b6f5061e94febcfee64c

See more details on using hashes here.

File details

Details for the file spatio-0.2.10-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for spatio-0.2.10-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5ba09d4b69d346ce104dcecf137780e4e7db0cf935f7dc5a72e6240d6b8a4b1b
MD5 0a8de224015fc8632734360be2988ed5
BLAKE2b-256 791404e102762d1722fcd73dda5a9d61f30f074607c511b41d8725cfea6af63f

See more details on using hashes here.

File details

Details for the file spatio-0.2.10-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: spatio-0.2.10-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 403.8 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for spatio-0.2.10-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 7279ec3d65ea5d032daa4035376767b33e439a84694014b8c7dad614012941a5
MD5 c24f91378c69e0f09b880779ea8d2dd6
BLAKE2b-256 9cb2f105b4e08551cee82c6af6c24bd2437d173a35c307e59068be4b698911c6

See more details on using hashes here.

File details

Details for the file spatio-0.2.10-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for spatio-0.2.10-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6160fe2771396bef958aa4a42ab728168a72e57823577af6b30640e38db20f85
MD5 9efb4f676a9bd06abe5a6f942cd19196
BLAKE2b-256 c35d3c2d4924e3b2ebd4418039f1c666c240e75419c31d69b9109ece946e9e58

See more details on using hashes here.

File details

Details for the file spatio-0.2.10-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for spatio-0.2.10-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 528185c9ad1254b4084b8ed70529ad4fe32699c0e72622253ee460f10468f17d
MD5 b0e7c74487717aebce919f1e3d92ce4d
BLAKE2b-256 771da6d0966536c2eb32f5097ccbe57f49981e939c23b9bbd3d1dbc0d86a8b54

See more details on using hashes here.

File details

Details for the file spatio-0.2.10-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for spatio-0.2.10-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a053c0cd427cf0236eb7eca313c77d6df6d24b2fe418cb2a494ada08bb74b6c5
MD5 ed7da76963a80d9327d7d0e12f6de2d6
BLAKE2b-256 4f98162813d7e55d1a2a0da6d2bbdb5eff2ffc0418bb519aa982d95986657541

See more details on using hashes here.

File details

Details for the file spatio-0.2.10-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: spatio-0.2.10-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 403.7 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for spatio-0.2.10-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b8e5b3735e5c9b948ddb68ed87511c908810b35cb8dbfd701bf0e7f9d5effd59
MD5 cbeb6d685ea460f6263b5dbcb6e5a283
BLAKE2b-256 8dc5982cf724b577b4571e9871aa3a2b92d7dfc38b4bd02747934f6ba91596d3

See more details on using hashes here.

File details

Details for the file spatio-0.2.10-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for spatio-0.2.10-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fbe1062f8ac83879e668978dc468ddad8c5ffdf4cdb4f64283cff0624cf18a76
MD5 a88da0bcd4ab7519290a484df9be4887
BLAKE2b-256 5943480ff24b5aa93520f6ed812550e2c1e34163b54f62a828a9d56465d5540e

See more details on using hashes here.

File details

Details for the file spatio-0.2.10-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for spatio-0.2.10-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e11c5ad360213defb670e81f7d44079e80d9feab2a87746c6c09f880f6957e1e
MD5 6c7ad80d04a6be399d6a536fe7fef5ed
BLAKE2b-256 0a11b06cd601d46650f1ba2e3ede497fc08f5fac50cfec71e3707e21e3e0b158

See more details on using hashes here.

File details

Details for the file spatio-0.2.10-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for spatio-0.2.10-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ca3226b7a49e8d2542efc734782b56665e3663cced14acbec5c83ca6853caf1d
MD5 d2fccc5ecad6f2ea3442df54b4ee4279
BLAKE2b-256 542c37f57be0089164d56e7d78c8e1421368099825aef2887372a4c27d2d0a8f

See more details on using hashes here.

File details

Details for the file spatio-0.2.10-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: spatio-0.2.10-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 403.1 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for spatio-0.2.10-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 e7634721cddd4d969667dd01747b8f9acf8aacb27ea77bfbd1f2400dea01f05b
MD5 2a1805088a58801906f1e721fa1336aa
BLAKE2b-256 c5d545cd3e9f3026905991277a6ea76d257ed0aa144a2318c84ef154734bf696

See more details on using hashes here.

File details

Details for the file spatio-0.2.10-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for spatio-0.2.10-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 eacf235315783607d18a2ac443e999bac44a0a0366749a06b3743f7b73e1ae7d
MD5 3024df3bae8c2a453718318a1b59078d
BLAKE2b-256 b3f34be1ba230112db8dd29e85e76625e75833104a7a3315e365602048d3a3ff

See more details on using hashes here.

File details

Details for the file spatio-0.2.10-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for spatio-0.2.10-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a0c1e55fdc49d187201483c414fc0c2ad6a210aeef6221a5d4cc942d2aa143ae
MD5 aafaefbe2b6aff7ce3445df290ed41eb
BLAKE2b-256 dd0edddd32a6e4b2d951417df2de9f7fe44ed6e38829ca8222890e9f853b241c

See more details on using hashes here.

File details

Details for the file spatio-0.2.10-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for spatio-0.2.10-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 963eea2e2475f61c38dc675b9c4dcc521230a209f28a26bdb5664b4f0338e8b7
MD5 fd92b01317624e76951a573c750079bc
BLAKE2b-256 4b5327cbdfff639ea973cc274627e51e7511b2e6ccaf96a8e72e8b22f953228a

See more details on using hashes here.

File details

Details for the file spatio-0.2.10-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: spatio-0.2.10-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 405.4 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for spatio-0.2.10-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 6fead7d9a45d0af673659ae5293ce95466126bf641df08c530ee47954c62b098
MD5 cafa06f7146ec5052501fed690c87709
BLAKE2b-256 1182e9d25a9c88adbe60cf8ec9b65de0a671fb4c0f7580dcda12ad4cbb7c3846

See more details on using hashes here.

File details

Details for the file spatio-0.2.10-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for spatio-0.2.10-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 96304835cb2bfbd95dd19a223c5c1b6b973b71659032c1c01cc3a521946b726b
MD5 1ddd1f19fe4dbdf81278a4e76a51d379
BLAKE2b-256 1d9c8681b53120b77ea37ad267546194a258ca651253363625a7f5ccc4adc3a5

See more details on using hashes here.

File details

Details for the file spatio-0.2.10-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for spatio-0.2.10-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a1cc7052293ead0a23187a83fb9b89492c0e5ef47897a11006386f85eb5f0ab5
MD5 156cef0f46731adee9d600a8c7e284a5
BLAKE2b-256 1eb298f0719df1f8f93ef8a9906a19596438bf0f9b0fb3226dcaca44ab080206

See more details on using hashes here.

File details

Details for the file spatio-0.2.10-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for spatio-0.2.10-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1ec71c3854997b2348033c46d9812c15cd9878b7200aa07eb8e5cd044806fe16
MD5 93b505c918e8799de32ae017edeefae7
BLAKE2b-256 30e5a0ec2afb29efe5d2c73f8428492f1364a56b47c7a591238fb9543775853e

See more details on using hashes here.

File details

Details for the file spatio-0.2.10-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: spatio-0.2.10-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 408.0 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for spatio-0.2.10-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 6333b8bf78cd7c1921f7346e3da4d3b0bdf26e3fbd6daca08e8d236d9156bc12
MD5 87fab08b0ddbd8bd3149626c96e9fb83
BLAKE2b-256 63bb278037dab54b0d5fb6a3d62b36f382581aee0ac8197572ebcbecfb341341

See more details on using hashes here.

File details

Details for the file spatio-0.2.10-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for spatio-0.2.10-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 74758775641c0ce567e8f910fd2c1a83f6e5a0de5ec5826b262b068b85220c3f
MD5 c099008b897b62136a060c4fa3fdcf48
BLAKE2b-256 965cb85a7022715675ae83dedd0201167a3d31fcc635a1cb9078b3e1fb811f86

See more details on using hashes here.

File details

Details for the file spatio-0.2.10-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for spatio-0.2.10-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 046c76629ee8a60446e1f5d832779b49e2a1e4b1e42c1aeadd3d2967af8a0afe
MD5 f354dc18d1454267a66e8327594ffeab
BLAKE2b-256 cf3361dda0e34a9b68a7b5cbf94c143f451a03f16f4c2f7a350913e5a32a7498

See more details on using hashes here.

File details

Details for the file spatio-0.2.10-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for spatio-0.2.10-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1a3544372f83a85932f5e848b5615ab16b556afdfbbf13ecd76f578a44c7c8a7
MD5 994f4b47f1e3d73eabeab735b9856d14
BLAKE2b-256 98371d5ba0a7593a9b3eb003266803a963ab2c9b4b0ec824fddc94238b60cd5e

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