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.9-cp314-cp314-win_amd64.whl (404.0 kB view details)

Uploaded CPython 3.14Windows x86-64

spatio-0.2.9-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (523.1 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64

spatio-0.2.9-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (489.7 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ ARM64

spatio-0.2.9-cp314-cp314-macosx_11_0_arm64.whl (444.5 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

spatio-0.2.9-cp313-cp313-win_amd64.whl (403.6 kB view details)

Uploaded CPython 3.13Windows x86-64

spatio-0.2.9-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (522.7 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

spatio-0.2.9-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (489.5 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

spatio-0.2.9-cp313-cp313-macosx_11_0_arm64.whl (444.0 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

spatio-0.2.9-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (522.8 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

spatio-0.2.9-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.9-cp312-cp312-macosx_11_0_arm64.whl (444.0 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

spatio-0.2.9-cp311-cp311-win_amd64.whl (403.2 kB view details)

Uploaded CPython 3.11Windows x86-64

spatio-0.2.9-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.9-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.9-cp311-cp311-macosx_11_0_arm64.whl (444.8 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

spatio-0.2.9-cp310-cp310-win_amd64.whl (405.5 kB view details)

Uploaded CPython 3.10Windows x86-64

spatio-0.2.9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (525.5 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

spatio-0.2.9-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (492.6 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

spatio-0.2.9-cp310-cp310-macosx_11_0_arm64.whl (447.5 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

spatio-0.2.9-cp39-cp39-win_amd64.whl (408.3 kB view details)

Uploaded CPython 3.9Windows x86-64

spatio-0.2.9-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (529.5 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

spatio-0.2.9-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (496.0 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ ARM64

spatio-0.2.9-cp39-cp39-macosx_11_0_arm64.whl (450.6 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: spatio-0.2.9-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 404.0 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.9-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 f5835555432137c2bc8fa26d00dbba79707c6a8e1568bdb805b9f7cb5e228510
MD5 28503eb1ced3258ab0516571b29cd319
BLAKE2b-256 3cf3b55285565fd80bf811e558a07800921ef9f124255e6c66cb8cb0b4bc1790

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for spatio-0.2.9-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fa9f9c958706f42cfe5f26d03b0c782587e035cb15a27ae8bf5da44e24f27f6b
MD5 8ad11a703342720da756ba6a9ffbc160
BLAKE2b-256 b774c1958a00f5f96abef3f12cc40790c09a0cfc3a475062899ce93a526476a3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for spatio-0.2.9-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 064548e12a1c0594b47e3feccf2b9700f05cb33fcc4e7ae67fb447308a59bbd9
MD5 6dd35430eee7a6572826d093928b4e46
BLAKE2b-256 458ad2f9f5fc23eaa030714630d905b4dd093696fdc81884ec98283543f19199

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for spatio-0.2.9-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b91bd88a6cdbe82ec6f6887efd688b98e3c2d32ffaa3153e36811b3fe1a626fb
MD5 445703b46d377371dc7fda35e5cc3b66
BLAKE2b-256 1297b1af2fac7f69f27106a19e9e9162de49e062e979de247ecffe6140981839

See more details on using hashes here.

File details

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

File metadata

  • Download URL: spatio-0.2.9-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 403.6 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.9-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 4d7468b5750971ee3689735a460fbdd7cef9e9e741084ac9346661bb16fc3ee5
MD5 b6988a372a111cae3f1538c94d1529ed
BLAKE2b-256 1ed0e8e354aebe0ec2e76cfd9a52b1c073e8b236659f3e33986a4abd495ec2a7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for spatio-0.2.9-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 925e41abf0f60953acfc1001e8cdd1194c3c2dc2e5413f65fbdf94141b2ce333
MD5 2905818cb4adda6745f681b5f21e3365
BLAKE2b-256 7c8c94784cbcb32e8560587dce2c842b2c9e0b79e6b7281f857c6d847aeddc6d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for spatio-0.2.9-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f6d02b7dd2e92a9bc93b29520b9ec4c856730ddc35b651edeb403290b9160507
MD5 58bf7b34b73824c2ff2bc27333727cf6
BLAKE2b-256 8356f6a60fb128fd99ceba75fcc37c31231c140db5fbcbe0d4d1ecc5d074e635

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for spatio-0.2.9-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 76fbd8cbbdcb57832a03a3c68aec4bb77fe334aba6bd90609a2f58c80a114964
MD5 061de8f6c644ed482f16fea217fdd3c2
BLAKE2b-256 90d5253ebf561a845d7ed92b6acddd763378bc546c1e2aaed15fc7e8c2267087

See more details on using hashes here.

File details

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

File metadata

  • Download URL: spatio-0.2.9-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.9-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 2a7b49d6261e9f3dbac94008fe7deeb411cdb60198bfa70cbacda177a251b838
MD5 eae5a43c091f685ccae91b19ec5f4e98
BLAKE2b-256 07074d0bfa8e9e30df41411ce5f5045072b5db43ab3e539ddcdee390e1097b58

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for spatio-0.2.9-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6df4d1bb6f4d8c1ae042e0832355c86d47135a0229324196744b859cf02f0457
MD5 47967cfebea4122f657bef5537543b54
BLAKE2b-256 56c712a4fb55c6117add91013fc3ea768a96218735c06c3ffe85ccc58ce899c7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for spatio-0.2.9-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f43e6f8e776260c81518a3697ea6caae91a58eee2a65433cb7768a75f3662a89
MD5 b23f91095497c5dc39b9aaedc0234380
BLAKE2b-256 9744835be715d904d1122f4872ad7bd9291080102e9ea9462aa65b693c046631

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for spatio-0.2.9-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 889a9c3f904dcef30b36b4cc2e65bf2d3755d2377cf5f091e508e7fc0cd9d045
MD5 1c01fb2a2d2afaa405c053966baf0afe
BLAKE2b-256 dd17192ef48b63e4f43d24c71c4efb762cb927576b0c9ce4b0012defdc6e7a3d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: spatio-0.2.9-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 403.2 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.9-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 521351b27c1f27ebc57ceaec8fd3ce65a89d502941c3e8cedc630425fdd160cd
MD5 8b5f3106605314f88ae9c090fb754da5
BLAKE2b-256 6326fa331a0bb4ccdf1813f1b81059c3ea5d824f91736031f6065d8d68d8e4e7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for spatio-0.2.9-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 49e8735daf64a5bf8c78d51ff37300d204b2a3dd3fb84ab112f452751ff56f70
MD5 ca2627aa3aa1bf1ac11807ee1881260f
BLAKE2b-256 c436be2da1606c455dc9aa048c009329ae9fa444557be54067f4977e6b186a53

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for spatio-0.2.9-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6570e3159a59027601b89995a66d91b5c957acfc3018a083d114be6202084bee
MD5 b14ab4b2a53adbf17a0aa977b4886ad6
BLAKE2b-256 fb4940e07cb20d966bebc37fd8eac082e994a7fa8c3a6da494180ad865398e9b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for spatio-0.2.9-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9ca0df8b503d87cfb895a445b7477f48790ed1be997d3c6546edcaedef5af504
MD5 26c0baabea459db46e9646f3ddc7a444
BLAKE2b-256 2bf93932a9d707f810a306d6932701289048451764647c1fddd3dcc25ce20b0d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: spatio-0.2.9-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 405.5 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.9-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 cac1d566e2c5c4e4dc2955e1382858d7f079515caaa2f6c4aa1734d60cd79cc9
MD5 9912438e2c73b68e88d3ee06effcc0c6
BLAKE2b-256 536a4634259843e464e56f87bb5389f3c2193cbc1f91d77d240898a4d552f927

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for spatio-0.2.9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4bc1279a7fc1c063d52b33a205f13a774ccb7f48c14a99aa3dfc00a8a23a2549
MD5 6724d0fe83ec4a3e43387f623c67d2e7
BLAKE2b-256 1354102b42cb95a6da4262d93bf0c2088272b7dc8684b83ba3154da947e8d7a4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for spatio-0.2.9-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b7e0eaf7f4dab79f34a9a28117f4b8cd6872cd31c6a5d7f0552e25fdf67ed738
MD5 e95d1ac731343e3aa2186e6671cb7ad1
BLAKE2b-256 042397ca1ef3ecc1843dacb0b40f7b61479295b14993c8ae0474ad0adb0ec8d1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for spatio-0.2.9-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 571ea2f7c0d5236045b03f34b798670bb026266a0301814e7a81f423bdfb43fa
MD5 fa68ff9458f5b54a5c01f852feb96ab8
BLAKE2b-256 e801c049168bb23691631594a8949fe3af8a87363d174adfedc84ba9d0050ab7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: spatio-0.2.9-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 408.3 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.9-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 90bb5da2a23095408c8ae4a0a0a106445ab7961c9496769ad4d0bc652ce6c8c5
MD5 77f9acf128030e9c3d611284b4142c16
BLAKE2b-256 59ef36389e74e964951803d116496115d2e8413f949b785194da351a932d56bb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for spatio-0.2.9-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2e639fed6523721d5a1a5ba17434ffdbfd86bb667bca0313ca3d9e3d4ee99a7b
MD5 e49468c5012d6aeacf2d9f17738a8f20
BLAKE2b-256 72ba7175afcaf295572c433dc232cdad5f7103b04d1993845e3c0101726abadb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for spatio-0.2.9-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1b7688ca125fac1fb07de49096cb47f773b8251b3b3f2e8604a15dfb8a0014c5
MD5 794ff386efaea158498a1e7cfe5efbe4
BLAKE2b-256 e67ace419ecdcadc11279ab77b4befe2cb500095c7191a86976109656ebbff33

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for spatio-0.2.9-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4eed3df50a97c83b4927d95ef0493fc8bdf7210842178c63a407415cbd98e61b
MD5 df68a2127f9e0e63e2c5bfd376eac328
BLAKE2b-256 c34a3d1003babde28f8cb1648d8ab0864634905f47acf39c49d4e728e6885f63

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