Geospatial Data Copilot

A natural-language interface over spatial/infrastructure data — ask a question in plain English about San Francisco's utility infrastructure and get back a SQL-grounded answer, an interactive map, or a semantic search result.

LangGraph ReAct agent Ollama (local LLM) DuckDB + spatial extension FastAPI Streamlit Chroma vector search
View the code on GitHub

Live demo map

This is a real render of the seeded dataset (~1,500 power assets — poles, transmission towers, transformers — fetched live from OpenStreetMap for downtown/Mission/SoMa San Francisco). This overview loads instantly with no LLM call involved; the full app renders maps like this on demand in response to a chat question.

Color-coded by condition/damage score. Click a marker for asset details.

What you can ask it

The full chat agent runs locally against Ollama and isn't hosted here (GitHub Pages only serves static files — see "Run it yourself" below). These are real, verified queries from development against the seeded dataset:

Show me all poles inspected in the last 6 months with a high damage score.
Generates a filtered SQL query; on the seeded data this genuinely returns zero rows, and the agent correctly reports "no poles match" instead of fabricating results.
How many assets are within 2 miles of San Francisco City Hall?
Resolves the landmark to coordinates and uses a spatial distance query (ST_Distance_Sphere), answering with the true total count even when the row preview is capped for context-window safety.
Which asset type has the highest average condition score decline this year?
Aggregates condition_score - condition_score_last_year grouped by asset type.
Show me the 10 poles in the worst condition on a map.
Renders an interactive Folium map with color-coded markers and popups — like the live demo map above, but scoped to a chat question. This is a real render of that exact query against the seeded dataset:
Find inspection notes similar to reports mentioning corrosion.
Semantic search over inspection notes embedded with nomic-embed-text, via Chroma's vector index — catches paraphrases like "heavy rust and metal thinning" that a keyword filter would miss.

Run it yourself

The interactive chat + map UI runs entirely locally (no API keys, no usage cost) via Ollama. To try it:

git clone https://github.com/DBishal13/geospatial-data-copilot
cd geospatial-data-copilot
pip install -r requirements.txt

ollama pull llama3.1:8b
ollama pull nomic-embed-text

python db/build_dataset.py
python db/build_notes_index.py

uvicorn api.main:app --port 8000
streamlit run frontend/app.py

Full setup details, architecture notes, and known-bugs-fixed writeup are in the README.