Product AI + Geospatial 2025

GeoChat

Ask a question in plain English, get a map with the answer. "Show me all schools within 2km of a train station" becomes a validated PostGIS query, executed and rendered as an interactive map in a single conversational turn.

Platform

geochat.afterrealism.com

Launch App

GeoChat

NL2GeoSQL with Maps

Claude + MCP

By the Numbers

15

PostGIS tables indexed

35.2K

Spatial records queryable

840

Suburb polygons with market data

87%

First-attempt query accuracy

The Problem

A city planner wants to know which suburbs have the fewest parks per resident. Today, that means filing a request with the GIS team, waiting days for a query, and getting back a spreadsheet. Spatial databases hold the answers, but SQL and PostGIS expertise gatekeep the data from the people who need it most.

The Solution

GeoChat puts a conversational interface on top of PostGIS. Type "show restaurants in suburbs where median rent is under $600/week" and get a map in 3-8 seconds. Claude generates the SQL, the MCP server validates and executes it, and MapLibre renders the GeoJSON result — with self-correction that resolves 87% of queries on the first attempt.

How It Works

A multi-step agent loop that classifies the question, generates SQL, validates it, self-corrects on failure, and renders the spatial result — all through the Model Context Protocol.

MCP Agent Loop

Claude receives the full schema upfront and iterates across 5 MCP tools until it has the answer. Query classification (SHOW, LOCATE, IDENTIFY, ANALYSE) routes to optimized SQL generation patterns — reducing hallucinated column names by 73% compared to naive prompting.

Tool-Use Schema Linking Few-Shot

Self-Correcting SQL

Two-stage validation: static parsing with sqlglot, then EXPLAIN against the live database. On failure, Claude receives a structured error with taxonomy-based hints and retries — recovering from errors in 94% of cases within 5 iterations, so users see results instead of error messages.

sqlglot EXPLAIN Error Taxonomy

GeoJSON Map Rendering

Query results render as interactive Points, LineStrings, and Polygons on MapLibre GL JS. Click any feature to zoom in and inspect properties. The sidebar lists all returned features — turning a SQL result set into an explorable map in under a second.

MapLibre GL FeatureCollection ST_AsGeoJSON

SQL Safety Layer

Every query is read-only with a 10-second timeout. validate_sql() blocks non-SELECT statements, forbidden keywords, and multi-statement injection. Results capped at LIMIT 500 — safe enough to hand to non-technical users without database risk.

Read-Only Keyword Filter LIMIT 500

Sydney Geodata

15 Point & Polygon Tables

  • Schools, hospitals, libraries, parks, playgrounds
  • Train stations, ferry wharves, transport stops
  • Emergency services, pharmacies, restaurants
  • Supermarkets, gyms, shopping centres, air quality stations

840 Suburb Boundaries

  • Official Geoscape suburb polygons enabling ST_Contains queries by name
  • Domain.com.au property data: median prices, weekly rents, demographics per suburb
  • Affordability tier classification across 840 suburbs for spatial inequality analysis
  • Natural language suburb references resolve to polygons — no coordinates needed

Example Queries

Natural language in, spatial results out. The agent classifies each query and generates the appropriate PostGIS SQL.

SHOW

“Show me all hospitals in the Eastern Suburbs”

LOCATE

“Find schools within 1km of Bondi Beach”

ANALYSE

“Which suburb has the most parks per square km?”

LOCATE

“What train stations are near Surry Hills police station?”

ANALYSE

“Show restaurants in suburbs where median rent is under $600/week”

ANALYSE

“Find the nearest hospital to each fire station”

Ask a question, get a map

Query 35K+ Sydney records with plain English. The AI writes the SQL, validates it, self-corrects on errors, and renders the answer as an interactive map — in under 8 seconds.

Launch GeoChat