Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
b6d4b32
adding docs and navigation for second bug bash
kadolor Sep 9, 2025
276b74b
adding Apache license
kadolor Sep 9, 2025
ea72545
fixing pre-commit
kadolor Sep 9, 2025
d2719cd
fixing pre-commit
kadolor Sep 9, 2025
5483ce8
[DOCS] changing import statements for notebook and README
kadolor Sep 11, 2025
ec1ab95
making markdown docs version of notebook with narrative
kadolor Sep 11, 2025
f75ebe7
additional changes, removal of .ipynb
kadolor Sep 11, 2025
ccc81ff
Merge branch 'main' into bug-bash
kadolor Sep 11, 2025
e2a1a71
continued fixes, removing interactive mode
kadolor Sep 12, 2025
bece094
changing introduction
kadolor Sep 12, 2025
a5cbc3e
adding markdown file of python quickstart
kadolor Sep 12, 2025
c40f423
Adding link to downloadable ipynb
kadolor Sep 12, 2025
227c617
Merge branch 'main' into bug-bash
kadolor Sep 12, 2025
67c3077
Finish applying stashed changes and resolve conflict
kadolor Sep 16, 2025
2590c99
Finish applying stashed changes and resolve conflict
kadolor Sep 16, 2025
02fa793
fixing
kadolor Sep 16, 2025
7136a7d
fix notebook
kadolor Sep 16, 2025
b10b081
Update docs/index.md
kadolor Sep 16, 2025
00961d1
fixing styling
kadolor Sep 16, 2025
1f9e342
adding lint to check for pre-commit, adding navigation styling, addin…
kadolor Sep 16, 2025
6b9a819
fixing notebook command
kadolor Sep 16, 2025
f677012
adding file
kadolor Sep 16, 2025
5cbbd6f
adding generated file from notebook
kadolor Sep 16, 2025
9d59ae4
adding to requirements.txt
kadolor Sep 16, 2025
9c7d825
changing lint file
kadolor Sep 16, 2025
10c011a
integrating feedback
kadolor Sep 17, 2025
1e99545
changing lint file
kadolor Sep 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
---
hide:
- navigation
---

title: Introducing SedonaDB
=======


<!---
Licensed to the Apache Software Foundation (ASF) under one
Expand All @@ -22,9 +25,13 @@ hide:
under the License.
-->

# SedonaDB
SedonaDB is a high-performance, dependency-free geospatial compute engine designed for single-node processing, making it ideal for smaller datasets on local machines or cloud instances.

The initial `0.1` release supports a core set of vector operations, with comprehensive vector and raster computation capabilities planned for the near future.

SedonaDB is a high-performance, dependency-free geospatial compute engine.
## Run a query in SQL, Python, or Rust

SedonaDB querying in SQL, Python, or Rust.

You can easily run SedonaDB locally or in the cloud. The first release supports a core set of vector operations, but the full-suite of common vector and raster computations will be supported soon.

Expand Down Expand Up @@ -81,7 +88,7 @@ SedonaDB has several advantages:

## Installation

Heres how to install SedonaDB with various build tools:
Here's how to install SedonaDB with various build tools:

=== "pip"

Expand All @@ -95,12 +102,8 @@ Here’s how to install SedonaDB with various build tools:
install.packages("sedonadb", repos = "https://community.r-multiverse.org")
```

## SedonaDB example with vector data

TODO

## Have questions?

Feel free to start a GitHub Discussion or join the Discord community to ask the developers any questions you may have.
Start a GitHub Discussion or join the [Discord community](https://discord.com/invite/9A3k5dEBsY) and ask the developers any questions you may have.

We look forward to collaborating with you!
94 changes: 0 additions & 94 deletions docs/quickstart-cli.md

This file was deleted.

20 changes: 10 additions & 10 deletions docs/quickstart-python.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"id": "a06df76b",
"metadata": {},
"outputs": [
Expand All @@ -36,9 +36,9 @@
}
],
"source": [
"import sedonadb\n",
"import sedona.db\n",
"\n",
"sd = sedonadb.connect()\n",
"sd = sedona.db.connect()\n",
"sd.sql(\"SELECT ST_Point(0, 1) as geom\").show()"
]
},
Expand Down Expand Up @@ -231,16 +231,16 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": null,
"id": "6dd816c7-fd3f-4358-b628-ef5e6940c95c",
"metadata": {},
"outputs": [],
"source": [
"df = sd.sql(\"\"\"\n",
"SELECT * FROM (VALUES \n",
" ('one', ST_GeomFromWkt('POINT(1 2)')), \n",
" ('two', ST_GeomFromWkt('POLYGON((-74.0 40.7, -74.0 40.8, -73.9 40.8, -73.9 40.7, -74.0 40.7))')), \n",
" ('three', ST_GeomFromWkt('LINESTRING(-74.0060 40.7128, -73.9352 40.7306, -73.8561 40.8484)'))) \n",
"SELECT * FROM (VALUES\n",
" ('one', ST_GeomFromWkt('POINT(1 2)')),\n",
" ('two', ST_GeomFromWkt('POLYGON((-74.0 40.7, -74.0 40.8, -73.9 40.8, -73.9 40.7, -74.0 40.7))')),\n",
" ('three', ST_GeomFromWkt('LINESTRING(-74.0060 40.7128, -73.9352 40.7306, -73.8561 40.8484)')))\n",
"AS t(val, point)\"\"\")"
]
},
Expand Down Expand Up @@ -355,7 +355,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": null,
"id": "3629c6e6",
"metadata": {},
"outputs": [
Expand All @@ -376,7 +376,7 @@
}
],
"source": [
"sedonadb.options.interactive = True\n",
"sedona.db.options.interactive = True\n",
"sd.sql(\"SELECT ST_Point(0, 1) as geom\")"
]
},
Expand Down
176 changes: 176 additions & 0 deletions docs/reference/quickstart-python.md
Comment thread
kadolor marked this conversation as resolved.
Outdated
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
<!---
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->

# Python Quickstart

SedonaDB for Python can be installed from **PyPI**:

```shell
pip install "apache-sedona[db]"
```

## Import SedonaDB

To get started, import the library and connect to a new session. You can run SQL queries directly on the session object.

```python
import sedona.db

sd = sedona.db.connect()
sd.sql("SELECT ST_Point(0, 1) as geom").show()
```

**Output:**

```sh
┌────────────┐
│ geom │
│ wkb │
╞════════════╡
│ POINT(0 1) │
└────────────┘
```

## Spatial Join Example

A common use case is performing a spatial join.
In this example, we'll find the country that each city belongs to by checking if the city's point geometry intersects with a country's polygon geometry.

### Load Datasets

First, load the cities and countries parquet files from their URLs into SedonaDB DataFrames.

```python
cities_url = "https://raw.githubusercontent.com/geoarrow/geoarrow-data/v0.2.0/natural-earth/files/natural-earth_cities_geo.parquet"
countries_url = "https://raw.githubusercontent.com/geoarrow/geoarrow-data/v0.2.0/natural-earth/files/natural-earth_countries_geo.parquet"

cities = sd.read_parquet(cities_url)
countries = sd.read_parquet(countries_url)
```

### Register Views

To query these DataFrames using SQL, they must be registered as temporary views in the session.

```python
cities.to_view("cities")
countries.to_view("countries")
```

### Run the Join Query

Now you can run a SQL query using `ST_Intersects` to join the two views.

```python
# Join the cities and countries tables
sd.sql("""
SELECT
cities.name AS city,
countries.name AS country,
countries.continent
FROM cities
JOIN countries
WHERE ST_Intersects(cities.geometry, countries.geometry)
""").show()
```

**Output:**

```
┌───────────────┬─────────────────────────────┬───────────────┐
│ city ┆ country ┆ continent │
│ utf8view ┆ utf8view ┆ utf8view │
╞═══════════════╪═════════════════════════════╪═══════════════╡
│ Suva ┆ Fiji ┆ Oceania │
├───────────────┼─────────────────────────────┼───────────────┤
│ Dodoma ┆ United Republic of Tanzania ┆ Africa │
├───────────────┼─────────────────────────────┼───────────────┤
│ Dar es Salaam ┆ United Republic of Tanzania ┆ Africa │
├───────────────┼─────────────────────────────┼───────────────┤
│ Bir Lehlou ┆ Western Sahara ┆ Africa │
...
└───────────────┴─────────────────────────────┴───────────────┘
```

## Creating a DataFrame Manually

You can also create a SedonaDB DataFrame from scratch using SQL `VALUES` clauses and geometry functions like `ST_GeomFromWkt`.

```python
df = sd.sql("""
SELECT * FROM (VALUES
('one', ST_GeomFromWkt('POINT(1 2)')),
('two', ST_GeomFromWkt('POLYGON((-74.0 40.7, -74.0 40.8, -73.9 40.8, -73.9 40.7, -74.0 40.7))')),
('three', ST_GeomFromWkt('LINESTRING(-74.0060 40.7128, -73.9352 40.7306, -73.8561 40.8484)')))
AS t(val, point)
""")

# Verify the object type
type(df)
```

**Output:**

```
sedonadb.dataframe.DataFrame
```

Once created, you can register it as a view and run further spatial operations on it.

```python
df.to_view("fun_table")
sd.sql("SELECT *, ST_Centroid(point) AS centroid FROM fun_table").show()
```

**Output:**

```
┌───────┬─────────────────────────────────────────────┬────────────────────────────────────────────┐
│ val ┆ point ┆ centroid │
│ utf8 ┆ wkb ┆ wkb │
╞═══════╪═════════════════════════════════════════════╪════════════════════════════════════════════╡
│ one ┆ POINT(1 2) ┆ POINT(1 2) │
├───────┼─────────────────────────────────────────────┼────────────────────────────────────────────┤
│ two ┆ POLYGON((-74 40.7,-74 40.8,-73.9 40.8,-73.… ┆ POINT(-73.95000000000002 40.75) │
├───────┼─────────────────────────────────────────────┼────────────────────────────────────────────┤
│ three ┆ LINESTRING(-74.006 40.7128,-73.9352 40.730… ┆ POINT(-73.92111155675562 40.7664673976246… │
└───────┴─────────────────────────────────────────────┴────────────────────────────────────────────┘
```

## Interactive Mode

For notebooks or interactive sessions, you can enable **interactive mode**. This eagerly prints the results of queries without requiring an explicit `.show()` call, which is useful for data exploration.

```python
sedona.db.options.interactive = True
sd.sql("SELECT ST_Point(0, 1) as geom")
```

**Output:**

```
┌────────────┐
│ geom │
│ wkb │
╞════════════╡
│ POINT(0 1) │
└────────────┘
```
Comment thread
kadolor marked this conversation as resolved.
Outdated

For non-interactive scripts or when working with very large datasets, it's best to leave this option `False` to avoid accidentally pulling large amounts of data.
Loading