MCPcopy Index your code
hub / github.com/apache/sedona-db

github.com/apache/sedona-db @apache-sedona-db-0.4.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release apache-sedona-db-0.4.0 ↗ · + Follow
11,464 symbols 41,430 edges 674 files 2,583 documented · 23%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

SedonaDB

PyPI Version PyPI Downloads Downloads Anaconda Version Conda Downloads

SedonaDB is an open-source single-node analytical database engine with geospatial as a first-class citizen. It aims to deliver the fastest spatial analytics query speed and the most comprehensive function coverage available.

SedonaDB is perfect for processing smaller to medium datasets on local machines or cloud instances. For distributed workloads, you can leverage the power of SedonaSpark, SedonaFlink, or SedonaSnow.

Architecture

SedonaDB Architecture

  • Columnar in-memory datasets

    • Spatial indexing
    • Spatial statistics
    • CRS tracking
    • Arrow format and zero serialization overhead
  • Spatial query optimization

    • Spatial-aware heuristic based optimization
    • Spatial-aware cost based optimization
    • Automatic disk spilling for large-scale spatial joins
  • Spatial query processing

    • Spatial range query, KNN query, spatial join query, KNN join query
    • Map algebra, NDVI, mask, zonal statistics

Raster functions are coming soon. We expect SedonaDB Raster will match all raster functions provided in SedonaSpark.

Features of SedonaDB

SedonaDB has several advantages:

  • High Performance: Built in Rust for exceptional speed and memory efficiency
  • Comprehensive Spatial Toolkit: Supports both vector and raster functions in a single library
  • CRS Propagation: Always maintains coordinate reference system information
  • Format Flexibility: Supports legacy and modern file formats including GeoParquet, Shapefile, GeoJSON
  • Dual APIs: Python and SQL interfaces for seamless workflow integration
  • Extensible: Easily customizable and extensible architecture
  • Ecosystem Integration: Interoperable with PyArrow-compatible libraries like GeoPandas, DuckDB, and Polars
  • Active Community: Great maintainers and contributors who encourage external contributions

Performance Benchmarks

This is a performance benchmark comparing SedonaDB 0.1.0, DuckDB 1.4.0, and GeoPandas 1.1.1 using SpatialBench Queries 1-12 at Scale Factors 1 and 10. Details can be found at Apache Sedona SpatialBench.

SF1 Benchmark Results SF10 Benchmark Results

Install

You can install Python SedonaDB with PyPI:

pip install "apache-sedona[db]"

Or with conda:

conda install sedonadb

Quick Start

Get started with SedonaDB in just a few lines:

import sedona.db

# Connect to SedonaDB
sd = sedona.db.connect()

# Run a simple spatial query
result = sd.sql("SELECT ST_Point(0, 1) as geom")
result.show()

Supported File Formats

SedonaDB supports a wide range of geospatial file formats:

  • Vector: GeoParquet, WKT, WKB, all formats supported by GeoPandas
  • Raster: Coming soon with full SedonaSpark compatibility

Overture buildings example

This section shows how to query the Overture buildings data.

Start by establishing a connection:

import sedona.db

sd = sedona.db.connect()

Read the dataset into a Python SedonaDB DataFrame. This is lazy: even though the Overture buildings table contains millions of rows, SedonaDB will only fetch the data required for the query.

df = sd.read_parquet(
    "s3://overturemaps-us-west-2/release/2026-02-18.0/theme=buildings/type=building/",
    options={"aws.skip_signature": True, "aws.region": "us-west-2"},
)
df.to_view("buildings")

Now run a query to compute the centroids of tall buildings (above 20 meters) in New York City:

nyc_bbox_wkt = (
    "POLYGON((-74.2591 40.4774, -74.2591 40.9176, -73.7004 40.9176, -73.7004 40.4774, -74.2591 40.4774))"
)

sd.sql(f"""
SELECT
    id,
    height,
    num_floors,
    roof_shape,
    ST_Centroid(geometry) as centroid
FROM
    buildings
WHERE
    is_underground = FALSE
    AND height IS NOT NULL
    AND height > 20
    AND ST_Intersects(geometry, ST_GeomFromText('{nyc_bbox_wkt}', 4326))
LIMIT 5;
""").show()

Here's the query output:

┌─────────────────────────┬────────────────────┬────────────┬────────────┬─────────────────────────┐
│            id           ┆       height       ┆ num_floors ┆ roof_shape ┆         centroid        │
│           utf8          ┆       float64      ┆    int32   ┆    utf8    ┆         geometry        │
╞═════════════════════════╪════════════════════╪════════════╪════════════╪═════════════════════════╡
│ 1b9040c2-2e79-4f56-aba… ┆               22.4 ┆            ┆            ┆ POINT(-74.230407502993… │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ 1b5e1cd2-d697-489e-892… ┆               21.5 ┆            ┆            ┆ POINT(-74.231451103592… │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ c1afdf78-bf84-4b8f-ae1… ┆               20.9 ┆            ┆            ┆ POINT(-74.232593032240… │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ 88f36399-b09f-491b-bb6… ┆               24.5 ┆            ┆            ┆ POINT(-74.231878209597… │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ df37a283-f5bd-4822-a05… ┆ 24.154542922973633 ┆            ┆            ┆ POINT(-74.241910239840… │
└─────────────────────────┴────────────────────┴────────────┴────────────┴─────────────────────────┘

Community & Support

Get Help

Contributing

We welcome contributions! Here's how you can get involved:

  • Report Issues: Found a bug? Open an issue on GitHub
  • Suggest Features: Have an idea? Start a GitHub Discussion
  • Fix Issues: Comment "take" on any open issue to claim it
  • Submit PRs: Brainstorm features with contributors and submit pull requests
  • Join Meetings: Monthly contributor meetings - we'd love to have you!

About SedonaDB

SedonaDB is a subproject of Apache Sedona, an Apache Software Foundation project. The project is governed by the Apache Software Foundation and subject to all the rules and oversight requirements. SedonaDB is built on top of Apache Arrow and Apache DataFusion for fast query processing.

Related Projects

  • Apache Sedona - The main Apache Sedona project for distributed spatial analytics
  • Sedona SpatialBench - Comprehensive benchmarking suite for spatial analytics performance testing

Extension points exported contracts — how you extend this code

LineStringTraitExt (Interface)
Additional convenience methods for [`LineStringTrait`] implementers that mirror `geo-types`. [7 implementers]
rust/sedona-geo-traits-ext/src/line_string.rs
CrsTransform (Interface)
Trait for transforming coordinates in a geometry from one CRS to another. - If the transform needs to handle only XY, i [13 …
rust/sedona-geometry/src/transform.rs
EvaluatedBatchStream (Interface)
A stream that produces [`EvaluatedBatch`] items. This stream may have purely in-memory or out-of-core implementations. T [9 …
rust/sedona-spatial-join/src/evaluated_batch/evaluated_batch_stream.rs
SedonaScalarKernel (Interface)
User-defined function implementation A `SedonaScalarUdf` is comprised of one or more kernels, to which it dispatches th [153 …
rust/sedona-expr/src/scalar_udf.rs
TypeMatcher (Interface)
A TypeMatcher is a predicate on a [SedonaType] TypeMatchers are the building blocks of an [ArgMatcher] that represent a [14 …
rust/sedona-schema/src/matchers.rs
LengthMeasurableTrait (Interface)
Internal trait that handles the actual length and perimeter computation for different geometry types [11 implementers]
rust/sedona-geo-generic-alg/src/algorithm/line_measures/length.rs
BinaryPredicate (Interface)
Trait to make operations generic over binary predicates [8 implementers]
c/sedona-tg/src/tg.rs
GeometryFactory (Interface)
Factory object to help the [GenericExecutor] iterate over various concrete geometry objects [5 implementers]
rust/sedona-functions/src/executor.rs

Core symbols most depended-on inside this repo

clone
called by 1369
rust/sedona-spatial-join/src/utils/once_fut.rs
iter
called by 451
rust/sedona-raster/src/traits.rs
collect
called by 384
rust/sedona-spatial-join/src/index/build_side_collector.rs
len
called by 290
rust/sedona-raster/src/array.rs
create_array
called by 264
rust/sedona-testing/src/create.rs
scalar
called by 217
rust/sedona-testing/src/benchmark_util.rs
as_ref
called by 211
rust/sedona-schema/src/datatypes.rs
to_pandas
called by 202
python/sedonadb/python/sedonadb/dataframe.py

Shape

Function 5,951
Method 3,696
Class 1,320
Enum 207
Route 202
Interface 88

Languages

Rust63%
C++13%
Python13%
C11%

Modules by API surface

c/sedona-tg/src/tg/tg.c758 symbols
c/sedona-geoarrow-c/src/geoarrow/geoarrow.hpp404 symbols
c/sedona-geoarrow-c/src/geoarrow/geoarrow.c353 symbols
python/sedonadb/tests/functions/test_functions.py178 symbols
c/sedona-geoarrow-c/src/nanoarrow/nanoarrow.h166 symbols
c/sedona-geoarrow-c/src/geoarrow/fast_float.h164 symbols
c/sedona-geoarrow-c/src/nanoarrow/nanoarrow.c127 symbols
c/sedona-geoarrow-c/src/nanoarrow/nanoarrow.hpp103 symbols
rust/sedona-geo-generic-alg/src/algorithm/line_measures/metric_spaces/euclidean/utils.rs99 symbols
c/sedona-geoarrow-c/src/geoarrow/geoarrow.h94 symbols
python/sedonadb/python/sedonadb/testing.py87 symbols
rust/sedona-raster/src/traits.rs84 symbols

Datastores touched

postgresDatabase · 1 repos

For agents

$ claude mcp add sedona-db \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page