GeoAgent is an LLM-powered (GPT-4o 2024-08-06) agent that analyzes and visualizes user-provided WGS84 (EPSG:4326) GeoJSON files as well as OpenStreetMap data for Germany retrieved from a database. The agent combines advanced React-Prompting with direct Function Calling.
- Automates and solves spatial tasks using GeoPandas and PostGIS.
- Provides interactive visualizations of GeoDataFrames.
- Geocodes addresses or places into points or polygons.
- Exports analysis results as an HTML map and messages as a TXT file.
🐍 Python_REPL
- A simple Python shell to execute basic Python commands for quick queries and operations.
📊 AnalystTool
- Plans, writes, executes, and debugs Python scripts for analyzing (Geo-)DataFrames.
🗄️ DatabaseTool
- Writes, executes, and debugs SQL queries for analyzing OpenStreetMap or (Geo-)DataFrame data.
- Performs point or polygon geocoding.
🗺️ MapperTool
- Visualizes the geometry column or one numeric or categorical column along with geometries:
1️⃣ Geometrical Data
- Visualizations of (multi-) Points, Lines, or Polygons.
- Heatmaps for points.
2️⃣ Numeric Data
- Supported classification schemas: BoxPlot, EqualInterval, FisherJenks, FisherJenksSampled, HeadTailBreaks, JenksCaspall, JenksCaspallForced, JenksCaspallSampled, MaxP, MaximumBreaks, NaturalBreaks, Quantiles, Percentiles, StdMean.
- Choosable number of classes.
- Supports Matplotlib colormaps (e.g., 'Blues') with an optional min/max value.
3️⃣ Categorical Data
- Choosable categories (e.g., 'A', 'B', 'C') or dynamically generated categories based on unique column values.
- Supports matplotlib colormaps.
- Creation of a venv via the requirements.txt
- Adjustment of some libraries (see readme)
- An OpenAI API key
- A PostGIS database with the following criteria:
- Tables:
data.osm_points,data.osm_lines,data.osm_polygons,data.dfs - EDB Language Pack 3,
plpython3uextension and language - OSM data can be imported into the
publicschema using a PBF file and thepg_osm_import.luascript (see Database-PostgreSQL) withosm2pgsql - Creation of the
geocode_function(see Database-PostgreSQL)
- Credentials (database and OpenAI API key) stored in the .env file.
- Run the agent using the following command:
streamlit run geoagent_app.py
- See Tests
- LangChain
- GeoPandas
- Streamlit
- PostGIS
- OSMNX
- Osm2pgsql Flex output

