Smart Spatial System
Ask a geospatial question in plain language and get map layers, tables, reports and files back.
Smart Spatial System is a plugin-based GeoAI backend with a React workbench. A question such as "rank these candidate properties by distance to metro stations, malls and main roads" is turned into a structured QuerySpec, planned as a DAG of spatial operations, executed by plugins against uploaded files or PostGIS, and returned as map-ready outputs with a full execution trace.
It is the application built on top of geochat-platform: plugins are written with geochat_sdk and executed through geochat_kernel.
Status: active development, mid-refactor. Phase 6 moves logic out of
orchestrator/into the layeredsmart_spatial_system/package (see docs/ARCHITECTURE_TARGET.md). Theorchestrator/*_service.pymodules are compatibility shims during that move.
How a query runs
natural-language question
→ QuerySpec LLM (OpenAI-compatible) or rule-based, with PostGIS semantic context
→ DeterministicPlanner + OP_CATALOG
→ DagPlan → DagExecutor
→ CapabilityRegistry weighted router, learns from user feedback
→ geochat_sdk plugins vector, raster, PostGIS, reporting, export
→ outputs map layers · tables · documents (PDF/HTML) · files · trace
Design decisions are recorded as ADRs in docs/: single kernel pipeline, artifact-based responses, a multilingual semantic layer (Persian queries today, language-neutral concepts inside), and a service-oriented modular backend.
What is in the box
- 36 plugins, including buffer, spatial join, intersection, predicates, dissolve, nearest neighbour, distance, area and perimeter, centroids, CRS transform, geometry validation, attribute statistics, zonal statistics, band math, NDVI and spectral indices, slope/aspect, raster clip/reclassify/threshold/statistics, raster-to-vector, geocoding, WMS/WFS fetcher, PostGIS connector, feature scoring and enrichment, local raster/vector loaders, report builder, PDF renderer and data export.
- Data sources: raster and vector uploads, CSV tables, WMS, WFS, PostGIS and remote URLs, grouped into projects.
- Workflows: real-estate site ranking with a generated PDF report, and NDVI analysis.
- Learning router: capability weights adjust from user feedback, with reviewable weight proposals.
- Workbench: React + Leaflet UI for queries, step-by-step progress, map layers, inspection, plugin settings and outputs.
Repository layout
api/ FastAPI app and routers
orchestrator/ query parsing, planning (QuerySpec, OP_CATALOG, DAG), routing, services
smart_spatial_system/ new layered package (application services; other layers being filled in)
plugins/ geochat_sdk capability plugins
config/plugins/ per-plugin YAML config (*.example.yaml are the templates)
templates/reports/ report templates (real-estate report)
scripts/sql/ PostGIS views for the Tehran OSM demo
examples/ small fake datasets for the real-estate workflow
frontend/ React + Vite workbench
tests/ pytest suite (~150 modules)
docs/ architecture, ADRs, API contracts, phase reports
Runtime data (outputs, uploads, projects) is written to var/ by default, or to SMART_SPATIAL_RUNTIME_DIR, and is not committed.
Getting started
Requires Python 3.11+ (matches CI and the Docker image), Node.js 20+, and optionally PostgreSQL with PostGIS.
git clone https://github.com/arazshah/smart_spatial_system.git
cd smart_spatial_system
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env # add your LLM key
uvicorn api.main:app --reload # http://127.0.0.1:8000/docs
Frontend:
cd frontend
cp .env.example .env
npm install && npm run dev # http://localhost:5173
PostGIS demo data (Tehran OpenStreetMap): see data/README.md.
Docker Compose (backend + frontend, PostGIS optional):
docker compose up --build
See docs/DEPLOYMENT.md for the full deployment guide — environment variables, authentication, CORS, and PostGIS setup for running this beyond your own machine.
Installing as a package
Alongside the pip install -r requirements.txt + uvicorn dev flow above,
the backend also installs as a regular Python package (pyproject.toml),
with optional extras for the heavier/domain-specific dependencies:
pip install -e ".[postgis,raster,pdf]" # editable install for local dev
# or: pip install ".[postgis,raster,pdf]" for a non-editable install
smart-spatial-api serve --host 0.0.0.0 --port 8000
# equivalent: python -m smart_spatial_system serve --host 0.0.0.0 --port 8000
Extras: postgis (psycopg), raster (rasterio, for NDVI/spectral-index
plugins), pdf (weasyprint, for PDF report rendering), llm (reserved,
currently no extra dependency), dev (pytest, ruff). Omitting an extra
does not break the app — the affected plugins are simply unavailable
(reported in the service's plugin registry), not a startup failure. See
docs/PHASE8_BACKEND_PACKAGING_CLI_PLAN.md
for how this was verified.
API at a glance
| Area | Endpoints |
|---|---|
| Query | POST /query · POST /planner/intent · POST /feedback |
| Requests & outputs | GET /requests · GET /requests/{id} · …/map-layers · …/outputs · …/outputs/files/{name} · …/documents/{name} |
| Projects & data | /projects · /uploads/raster · /uploads/vector · /data-sources/{csv-table,wms,wfs,postgis,url} |
| Plugins & settings | /plugins · /plugins/{id}/config · /settings/runtime · /settings/llm/smoke-test |
| Router weights | /weights · /weights/save · /weights/reload · /weights/proposals/apply |
| System | GET /health |
Full request and response contracts are in docs/phase5_query_api_contract.md and the other docs/phase5_* files.
Tests
pytest
Author
Release files for smart-spatial-system 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| smart_spatial_system-0.1.0.tar.gz | 573.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| smart_spatial_system-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.1 MB
Release files / smart_spatial_system-0.1.0.tar.gz
| Download URL | smart_spatial_system-0.1.0.tar.gz |
|---|---|
| Size | 573.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9c322c4e0def435f2916e4cd3d58f315be6c5c4828c37dd36f5ef70f0c159195
|
|
BLAKE2b-256 checksum How to use checksums |
1169f06e96446dfc120a66837ed9948a6182c2090ed3208f5bb56199bedc2c2a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 12, 2026.
Transparency logRelease files / smart_spatial_system-0.1.0-py3-none-any.whl
| Download URL | smart_spatial_system-0.1.0-py3-none-any.whl |
|---|---|
| Size | 516.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
392f8ce0ebe8c92030836aadb8ccf474e61dd4261183458b6ac387661591533a
|
|
BLAKE2b-256 checksum How to use checksums |
8b59f6fb3e34fa08eca3bb7c27e10ac17f7e0bb72e9c82fe9e541e71772062ec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 12, 2026.
Transparency log