Spatial Data Analysis Made Simple

Enhance your PretzelAI with powerful spatial capabilities using DuckDB's spatial extension, HTTPFS for remote data access, and OGC API Features endpoints.

spatial_analysis.sql
-- Load spatial extension
LOAD spatial;
LOAD httpfs;
LOAD pivot_table;

-- Query remote GeoJSON via HTTPFS
CREATE TABLE cities AS 
SELECT * FROM 
st_read('https://example.com/data/cities.geojson');

-- Spatial analysis
SELECT name, 
       st_area(geometry) AS area,
       st_length(geometry) AS perimeter
FROM cities
WHERE st_within(geometry, 
    st_geomfromtext('POLYGON((...))'));

-- Create OGC API Features endpoint
CALL ogc_api_serve('cities', 8080);

Powerful Spatial Features

DuckDB Spatial Extension

Full integration with DuckDB's spatial extension for advanced geospatial operations including distance calculations, spatial joins, and geometric transformations.

HTTPFS & ZIPFSX

Access remote spatial data directly from HTTP endpoints or ZIP archives with the HTTPFS and ZIPFSX extensions, supporting GeoJSON, Shapefiles, and more.

Pivot Table Extension

Summarize and analyze spatial data with powerful pivot tables, grouping by geographic attributes and aggregating spatial metrics.

OGC API Features

Serve your spatial data through standards-compliant OGC API Features endpoints, enabling interoperability with GIS software like QGIS and ArcGIS.

Spatial Wizard

Interactive wizard for common spatial operations like buffer creation, intersection analysis, and spatial aggregation with intuitive visual feedback.

Visual Analytics

Integrated mapping and charting tools to visualize spatial patterns, heatmaps, and temporal trends directly within the interface.

Interactive Spatial Analysis

Spatial Operations

Query Editor

Spatial Preview

Query Results

park_name buffer_geom
Central Park POLYGON((...))
Riverside Park POLYGON((...))
Prospect Park POLYGON((...))
3 rows fetched

OGC API Features Endpoint

Serve your spatial data through standards-compliant OGC API Features endpoints, making your data accessible to any GIS software that supports the standard.

Standards Compliance

Fully compliant with OGC API Features 1.0 specification

High Performance

Leverage DuckDB's speed for fast spatial queries

Secure Access

Optional authentication and rate limiting

Terminal > Start OGC API Server
$ duckdb spatial_data.db
DuckDB> LOAD spatial;
DuckDB> LOAD flockmtl;
DuckDB> LOAD open_prompt;
DuckDB> LOAD httpfs;
DuckDB> CALL flockmtl.set_api_key('your-api-key-here');
DuckDB> LOAD flockmtl;
DuckDB> LOAD open_prompt;
DuckDB> CALL flockmtl.set_api_key('your-api-key-here');
DuckDB> CALL ogc_api_serve('cities', 8080);
DuckDB> CALL open_prompt.set_api_key('your-api-key-here');
# Server started on port 8080
# Endpoints:
/api - Landing page
/api/conformance - Conformance classes
/api/collections - Feature collections
/api/collections/cities/items - Features

Get Started with PretzelAI Spatial

Installation Methods

Docker Installation

The easiest way to get started with all spatial extensions pre-installed.

$ docker pull pretzelai/spatial:latest
$ docker run -p 8080:8080 -p 5432:5432 \
-v ./data:/data \
pretzelai/spatial

The Docker image includes all required extensions: spatial, httpfs, zipfsx, pivot_table, and the OGC API server.

Made with DeepSite LogoDeepSite - 🧬 Remix