GeoContra: From Fluent GIS Code to Verifiable Spatial Analysis with Geography-Grounded Repair
Yinhao Xiao, Rongbo Xiao, Yihan Zhang

TL;DR
GeoContra is a framework that verifies and repairs LLM-generated GIS scripts to ensure geographic correctness, significantly improving the reliability of spatial analysis workflows.
Contribution
It introduces a geospatial contract-based verification and repair system for LLM-driven GIS code, enhancing correctness and geographic validity.
Findings
Improves spatial correctness from 47.6% to 77.5% for DeepSeek-V4.
Raises average correctness across models by 26.6%.
Detects and fixes geographic rule violations in GIS scripts.
Abstract
Reliable spatial analysis in GIScience requires preserving coordinate semantics, topology, units, and geographic plausibility. Current LLM-based GIS systems generate fluent scripts but rarely enforce these geographic rules at scale. We present GeoContra, a verification and repair framework for LLM-driven Python GIS workflows. It represents each task as an executable geospatial contract-including natural-language questions, schemas, CRS metadata, expected outputs, spatial predicates, topology, metrics, required operations, and forbidden shortcuts. Generated programs undergo static rule inspection, runtime validation, and semantic verification, with violations fed back into a bounded repair loop. Evaluated on 7,079 real geospatial tasks across 15 Boston-area zones, 9 task families, and 11 open-source models (600 runs each), GeoContra improves spatial correctness on closed models from…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
