query_spatial_sql
Run spatial SQL queries on GeoJSON and geospatial metadata to filter, aggregate, and compute spatial metrics like area and intersections, returning JSON results.
Instructions
Execute spatial SQL queries on GeoJSON FeatureCollections or tabular geospatial metadata. Modeled after GeoLibre's DuckDB Spatial query panel.
Supports:
Standard SQL: SELECT, WHERE, GROUP BY, ORDER BY, LIMIT
Spatial Predicates: ST_Area, ST_Centroid, ST_Length, ST_Intersects
Args: sql: SQL query string (e.g. "SELECT id, severity, ST_Area(geom) as area_ha FROM features WHERE severity = 'HIGH'") geojson: GeoJSON FeatureCollection string (from any eo-mcp tool). table_name: Virtual table name (default 'features').
Returns: JSON string containing result columns, rows, and matched feature count.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | ||
| geojson | Yes | ||
| table_name | No | features |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |