Introduction to Spatial Data Analysis using Kepler.gl Ai Assistant
Author: Xun Li Dec 17 2024
- Updated May 30 2025
Contents
- Architecture
- Get Started
- Chapter 1: Spatial Data Wrangling (1): Basic Operations
- Chapter 2: Spatial Data Wrangling (2): GIS Operations
- Chapter 3: Basic Mapping
- Chapter 4: Rate Mapping
- Chapter 5: Exploratory Data Analysis (1) - Univariate and Bivariate Analysis (coming soon)
Architecture
The AI Assistant is a module that adds an AI chatbot to Kepler.gl. This module aims to integrates Kepler.gl with AI-powered capabilities, enabling it to interact with multiple AI models seamlessly.
Overview
The system is designed to enable Kepler.gl, a React-based single-page application, to integrate an AI Assistant Module for performing tasks with large language models (LLMs) like OpenAI GPT models, Google Gemini models, Ollama models, etc.
Below is a flow map that shows how a user can update a basemap in Kepler.gl through a simple AI-driven prompt, showcasing the integration of LLMs with application actions and rendering.
The AI Assistant Module also provides a set of tools to support data analysis and visualization. These AI Tools are designed to be used in conjunction with the Kepler.gl application and transform kepler.gl into a powerful spatial data analysis and visualization tool. For more details about the AI Assistant Module, please to https://github.com/geodacenter/openassistant.
Why LLM tools
LLMs are fundamentally statistical language models that predict the next tokens based on the context. While emergent behaviors such as learning, reasoning, and tool use enhance the model's capabilities, LLMs do not natively perform precise or complex computations and algorithms. For example, when asked to compute the square root of a random decimal number, ChatGPT typically provides an incorrect answer unless its Python tool is explicitly called to perform the calculation. This limitation becomes even more apparent with complex tasks in engineering and scientific domains. Providing computational tools for LLMs offers a solution for overcoming this problem and helps you successfully integrate LLMs with your applications.
AI Tools
LLMs use these AI Tools to perform spatial data analysis and visualization tasks to help users explore and understand their data.
For example, a user can ask the AI Assistant to simply change the basemap to a voyager
basemap, and the AI Assistant will call the basemap
tool to change the basemap.
For complex tasks, the AI Assistant can use multiple tools to perform the task. For example, a user can ask the AI Assistant if the points dataset loaded in kepler.gl is clustering in zipcode areas. The AI Assistant could call the following tools to perform the task:
mapBoundary
to get the boundary of current map viewqueryUSZipcode
to get a list of zipcodes using the map boundaryusZipcode
to fetch the geometries of the zipcodes from Github sitesaveData
to save the zipcode areas as a new GeoJSON dataset in kepler.glspatialJoin
to count the number of points in each zipcode areasaveData
to save the spatialJoin result as a new dataset in kepler.glweightsCreation
to create a e.g. queen contiguity weights using the spatialJoin resultlocal Moran's I
to apply local Moran's I using the counts and the queen contiguity weightssaveData
to save the local Moran's I result as a new dataset in kepler.gladdLayer
to add the local Moran's I result as a new layer in kepler.gl
These fine grained spatial tools are designed to transform the LLMs, which are fundarmentally statistical language models, into powerful spatial data analysis and visualization AI Agent.
As of May 2025, the AI Assistant Module supports the following AI Tools:
Kepler.gl Tools
Plot Tools
- eCharts Plots
- Vega-Lite Plots (coming soon)
Query Tools
OSM Tools
Spatial Analysis Tools (powered by Geoda)
- Geo Tools
- Data Tools
- data standardization
- standardization (z) / deviation from mean / standardization (MAD) / range adjust / range standardize
- data classification
- quantile
- natural Jenks breaks
- equal interval
- percentile
- box
- standard deviation
- unique values
- data by rates (comming soon)
- Spatial Join
- Spatial Weights
- weightsCreation
- queen/rook
- k-nearest neighbors
- distance band
- weightsCreation
- Spatial Autocorrelation
- global Moran's I
- local spatial autocorrelation
- local Moran's I
- local Geary's C
- local Getis-Ord Gi*
- quantile LISA
- spatial regression
- OLS with spatial diagnostics
- Spatial Lag Model
- Spatial Error Model