GIS Code: Why "No Errors" Doesn't Mean "Correct" A new analysis warns that AI-generated code for geographic information systems (GIS) can produce 'no errors' while being fundamentally wrong, citing coordinate reference system (CRS) mismatches, spatial autocorrelation in machine learning, and the 'pretty map' fallacy as common pitfalls. The author advises forcing explicit projection checks, using spatial blocking instead of random train-test splits, and providing explicit operational rules in prompt engineering to avoid these failures. GIS Code: Why "No Errors" Doesn't Mean "Correct" The Silent CRS Trap The most common "invisible" failure is the Coordinate Reference System CRS mismatch. An AI might suggest a simple buffer like this: buffered = gdf.buffer 1000 If your data is in EPSG:4326, that 1000 isn't meters—it's degrees. The code runs, the geometries are created, but your analysis is fundamentally broken. To build a real-world AI workflow for GIS, you have to force the agent to be explicit about projections. A more robust approach looks like this: if gdf.crs is None: raise ValueError "The input dataset has no CRS." if gdf.crs.is geographic: projected crs = gdf.estimate utm crs if projected crs is None: raise ValueError "A suitable projected CRS could not be determined." gdf = gdf.to crs projected crs buffered = gdf.buffer 1000 Even then, you have to watch out for datasets spanning multiple UTM zones. API correctness $\neq$ spatial correctness. Spatial Autocorrelation in ML Another area where AI-generated code leads me astray is in model evaluation. A standard train test split is the default suggestion for almost any ML task: python from sklearn.model selection import train test split X train, X test, y train, y test = train test split X, y, test size=0.2, random state=42 In GIS, this is often a mistake. Because nearby points are usually similar spatial autocorrelation , a random split puts neighboring samples in both sets. Your accuracy score looks amazing, but the model is just memorizing local patterns. It’ll likely crash and burn the moment you apply it to a new region. For a honest deep dive into model performance, you need: Spatial blocking or geographic grouping Region-level holdouts Distance-based separation Rendering is not Verification The final gotcha is the "pretty map" fallacy. A map can render perfectly while using a misleading projection or ignoring missing values. Just because the software produced an image doesn't mean the analysis is valid. When using an LLM agent for GIS, I've found you have to provide explicit operational rules in your prompt engineering, such as "Never calculate area or distance in a geographic CRS" or "Always verify spatial alignment before performing raster math." Next OpenRouter Acquisition: Stripe's $10B Move → /en/threads/2348/