Can ChatGPT do GIS? Partly. Large language models are good at the language side of GIS: understanding a request, choosing a method, writing PostGIS or GeoPandas code and explaining results. They are poor at geometry done in their heads, and the code they write can take shortcuts: treating latitude and longitude as a flat grid overstates east-west distances by 10% in Karachi and 59% in Calgary. The pattern that works confines the model to classifying the task and extracting parameters through schema-validated function calls, and runs every distance, data fetch and optimisation in deterministic tools after the user confirms.
Update, 30 October 2026: the facility location pattern in this article is now published. SOCA: A Conversational Agent for Facility Location Problems (Cho and Imran, ISPRS International Journal of Geo-Information 15(11), 494) confines the LLM to classifying the formulation and extracting scalar parameters through schema-validated function calls, and hands study area resolution, open-data acquisition, distance computation and exact solution of P-Median, P-Center, MCLP and LSCP to deterministic tools. Every specification is confirmed by the user before solving, and the solutions matched the spopt reference optima on all four models. The code is on GitHub.
This article covers what LLMs do well in GIS work, where they fail (with failures I computed), the architecture I use to get reliable results, the main use cases, published work worth knowing, and a checklist for evaluating any LLM GIS tool.
What are LLMs good at in GIS work?
LLMs are good at tasks where the input and output are language or code, and a person or a program can check the result. In GIS that covers a lot of the day:
- Intent parsing. "Which neighbourhoods are more than 4 minutes from a fire station?" becomes a service-area analysis on a road network, with a population layer and a time threshold.
- Choosing a method. Knowing that a fixed budget of stations calls for maximal covering and a coverage mandate calls for set covering, as in my fire station location article.
- Writing code. PostGIS queries, GeoPandas scripts, ArcPy and QGIS processing calls, with the syntax right far more often than not.
- Explaining. Turning a results table into a plain-language summary for a council report.
- Documentation and metadata. Drafting layer descriptions, field definitions and lineage notes from a schema.
- Classifying text attributes. Mapping free-text land use or business categories to a fixed code list.
All of these share one property: the model produces words or code, and the numbers come from running something.
Where do LLMs fail at GIS?
LLMs fail when they have to do spatial arithmetic in text or vouch for data. The main failure modes:
- Distance and area by inspection. Asked how far apart two coordinates are, a model predicts a plausible number. It may be close for famous city pairs it has seen and wrong for the rest.
- Coordinate arithmetic shortcuts in code. Treating degrees as metres, or degrees times 111 km as a flat grid, is quick, common in scripts and wrong away from the equator.
- Axis order and CRS. Latitude-longitude versus longitude-latitude, and geographic versus projected coordinates, are easy to swap silently.
- Raw geometry. Writing out polygon coordinates, buffering by hand or judging whether a point is inside a shape from its coordinates.
- Invented data. Dataset names, URLs, field names and statistics that sound right and do not exist.
The second one is the easiest to show with numbers, so I computed it. I took a true 10 km trip from six city centres on three bearings, worked out the end point on the WGS 84 ellipsoid with pyproj's Geod, and then measured the same trip with the shortcut sqrt(dlat² + dlon²) × 111.32 km.
| City | Latitude | North-south trip | Diagonal (45°) | East-west trip | Area of a 0.01° cell |
|---|---|---|---|---|---|
| Karachi | 24.9°N | +0.5% | +5.4% | +10.1% | +10.7% |
| Bahawalpur | 29.4°N | +0.4% | +7.8% | +14.7% | +15.2% |
| Islamabad | 33.7°N | +0.4% | +10.7% | +20.1% | +20.5% |
| Toronto | 43.7°N | +0.2% | +20.6% | +38.0% | +38.3% |
| Calgary | 51.0°N | +0.1% | +32.8% | +58.8% | +58.9% |
| Edmonton | 53.6°N | 0.0% | +38.4% | +68.0% | +68.0% |
A degree of longitude shrinks with the cosine of latitude, and the shortcut ignores that. For comparison, the haversine formula on a sphere stays within 0.4% of the ellipsoid in every case above. It is the same root cause as the Web Mercator distance error, this time arriving through code.
The error carries straight into analysis. Using the three optimal Calgary station sites and the Kontur population hexagons behind my Site Selection Showdown, I counted residents within 3 km of any site:
- Geodesic 3 km: 185,244 residents.
- Shortcut "3 km": 129,932 residents, 29.9% fewer, because each circle is really an ellipse squeezed east-west.

The shortcut is nearly right north-south and badly wrong east-west. In Calgary it drops 55,312 residents from a 3 km coverage count.
Axis order fails more dramatically. Swap Karachi's coordinates and the point (67.01°N, 24.86°E) lands in Finnish Lapland, 5,504 km away. Swap Islamabad's and it lands in the Barents Sea, 4,910 km away. Calgary's swap fails loudly, because −114° is not a valid latitude, which makes it the lucky case.
The fix in code is short. Ask for it explicitly, and check that the code you get looks like this:
from pyproj import Geod
geod = Geod(ellps="WGS84")
# Wrong away from the equator: degrees treated as a flat grid
km_bad = ((lat2 - lat1) ** 2 + (lon2 - lon1) ** 2) ** 0.5 * 111.32
# Right: geodesic distance on the WGS 84 ellipsoid (note lon, lat order)
_, _, metres = geod.inv(lon1, lat1, lon2, lat2)
-- PostGIS: residents within 3,000 metres of any site, on the geography type
SELECT SUM(d.pop) AS covered
FROM demand d
WHERE EXISTS (
SELECT 1 FROM sites s
WHERE ST_DWithin(d.geom::geography, s.geom::geography, 3000)
);
ST_DWithin on geography takes its distance in metres. On geometry in EPSG:4326 it takes degrees, which is the same trap in SQL.
What does "LLM parses, tools compute" look like?
The reliable pattern gives the language model two jobs, reading the request and writing the explanation, and gives every number to code. In a facility location agent the flow is:
- Request. "Where should 5 fire stations go in Calgary to reach the most people within 4 minutes?"
- Classify and extract. The model calls a function with typed arguments: the formulation (MCLP), the number of facilities (5), the service standard (4 minutes) and the place name.
- Schema check. Code validates the call. An unknown model name, a negative facility count or a missing parameter goes back to the model with the error.
- Confirm. The user sees the specification in plain terms and approves or edits it. Nothing runs before this.
- Deterministic tools. A geocoder resolves the boundary, data tools fetch population, roads and candidate sites, a network tool computes travel times, and an exact solver finds the optimum.
- Explain. The model writes the summary from the results table and quotes its numbers exactly.

Two model calls, both on text. Coordinates, travel times and the optimum all come from code.
The function schema is where the design lives. The model chooses among named options and fills bounded fields, and nothing in it accepts a coordinate:
from typing import Literal
from pydantic import BaseModel, ConfigDict, Field
class FacilityLocationSpec(BaseModel):
model_config = ConfigDict(extra="forbid")
formulation: Literal["p_median", "p_center", "mclp", "lscp"]
place_name: str = Field(description="Resolved to a boundary by a geocoding tool")
facilities: int | None = Field(None, ge=1, le=200, description="Required for p_median, p_center, mclp")
service_standard_min: float | None = Field(None, gt=0, le=60, description="Required for mclp, lscp")
travel_mode: Literal["drive", "walk"] = "drive"
demand: Literal["population"] = "population"
The confirmation step matters as much as the schema. "Five stations within 4 minutes" can mean maximal covering or a p-median with a 4-minute cap, and only the user knows which. If you want to see how much the choice of standard and station count changes the answer, the coverage curve article shows it for three cities.
Which GIS tasks are worth giving to an LLM?
The tasks worth giving to an LLM are the ones where its output is code or labels that a tool runs or a reference list checks.
| Use case | What the LLM does | What the tools do | Check before trusting |
|---|---|---|---|
| Natural language to SQL or PostGIS | Writes the query from the schema | Database runs it | Read the query; geography vs geometry; row counts |
| GeoPandas or ArcPy scripts | Writes the script | Python runs it | CRS before any .area, .buffer or distance |
| Metadata and documentation | Drafts descriptions from the schema | None | A person reviews it |
| Classifying features by text attributes | Maps text to a code list | Validator checks codes | Confusion matrix on a labelled sample |
| Address cleanup | Parses the residue rules miss | Rules, geocoder, validator | Hold-out match and false-match rates |
| Location-allocation agents | Classifies the problem, extracts parameters | Data, travel times, exact solver | User confirms the specification |
Address cleanup gets its own walkthrough in cleaning address data before geocoding, with the schema and validation gate. The same idea runs through every row: the model's output goes into something that can reject it.
What published work exists on LLMs for GIS?
Three lines of work are worth knowing, and all of them put tools or code between the model and the answer.
- Autonomous GIS and LLM-Geo. Li and Ning's Autonomous GIS: the next-generation AI-powered GIS (International Journal of Digital Earth, 2023) used GPT-4 to break a task into a solution graph of geoprocessing steps, generate Python for each, run it and debug failures. The LLM-Geo repository is candid about limits: its authors estimate about an 80% chance of a successful run with GPT-4 and note that outputs vary between runs.
- GeoGPT. Zhang and colleagues' GeoGPT (2023) connects an LLM to established GIS tools for data collection, processing and visualisation, in the style of AutoGPT tool use.
- Commercial assistants. Esri has added AI assistants across ArcGIS, several of them still in beta, for documentation help, notebooks and in-app actions.
Code-generating agents like LLM-Geo are flexible, because they can attempt any task Python can express. The cost is that each run writes new code, which is where shortcuts like the one above come from. Tool-calling agents with fixed, tested tools are narrower and more repeatable. For decisions such as where to put a station, I prefer the second.
How should you evaluate an LLM GIS tool?
Evaluate it with tasks whose answers you already know, and check where each number came from. A checklist:
- Known distance. Ask for the distance between two points at your latitude and compare with a geodesic calculation.
- Known area. Give it a polygon with a published area, such as a city boundary.
- High-latitude buffer. Ask for a 3 km buffer in Calgary or Edmonton and measure its east-west width.
- Swapped coordinates. Supply a point in latitude-longitude order without saying so, and see whether it notices.
- Data provenance. Every dataset should be named, versioned and linked, and the links should resolve.
- Tool trace. You should be able to see each tool call and its arguments, or the generated code, and rerun it.
- CRS stated. The tool should say which CRS each measurement used.
- Numbers from tools. Figures in the summary should match the tool output exactly.
- Confirmation before compute. It should show you the parsed specification before running anything slow or costly.
- Repeatability. The same request twice should give the same specification and the same result.
A tool that passes 1 to 4 because its tools compute and fails 5 to 10 is still risky, because you cannot audit it.
What should you take from this?
LLMs can do the parts of GIS that are language: understanding a request, choosing the method, writing the code and explaining the result. They should not be trusted to compute geometry, and code they write should be checked for the degree shortcut, axis order and CRS. The reliable design limits the model to classification and parameter extraction through schema-checked function calls, runs every measurement and optimisation in deterministic tools, and asks the user to confirm before solving. That design is what SOCA implements for facility location, and it carries over to address cleaning, query writing and most other GIS tasks.
If you want an LLM-assisted GIS workflow built or an existing one audited, email me at mahad.imran29@gmail.com.