Hi! Welcome to my passion projects: openChatGIS.
This is a tool that allows you to chat with an llm and issue GIS commands to it through a chat interface. Everything you see is built to make your GIS workflows more efficient and less repetitive. The goal is to make it easier to use GIS tools and data in your daily work.
The project is still in development, so expect some bugs (sorry for that!). Features to be added in the future. Feel free to reach out to me if you have any questions or feedback.
Thank you for using openChatGIS!
June Alexis
The interface is arranged as a chat pane situated beneath the map canvas. The language model itself is not hosted with the application. An API key is supplied by the user and is applied only to the request on which it is transmitted; the server does not retain a copy of the same. Boundary lookup is carried out against a GeoParquet of Philippine administrative units. Spectral indices and color composites are obtained from Google Earth Engine, subject to prior authentication through a Google account or through a service account. The sensor is selected according to the administrative level of the unit being requested, wherein a barangay is taken from Sentinel-2, a municipality from Landsat 8/9, and a province or a region from MODIS.
The supported means of running the application is Docker. The image is built on Python 3.12. The .venv present in this repository belongs to an earlier interpreter and is not the environment utilized by the container.
cp .env.example .env docker compose up --build
Once the container is up, the application is opened at http://localhost:8012.
A provider is then selected under Settings. A model name is entered in the event that a model other than the default is required, after which the API key is saved. The key remains in this browser.
Under Settings, either Google account or Service account is selected. The credential remains in this browser and is attached to the chat request. The server does not store the same.
It should be noted that a Google sign-in does not provision a service account. What it provides is a refresh token for this application, from which Earth Engine subsequently issues short-lived access tokens. The refresh token remains in the browser.
The following is performed once, by whoever is deploying the application:
http://localhost:8012/auth/gee/callback.env as GEE_OAUTH_CLIENT_ID and GEE_OAUTH_CLIENT_SECRET.With the foregoing in place, Settings is opened in the application, Google account is selected, the Cloud project id registered for Earth Engine is entered, and Connect is clicked.
Where a service account is preferred instead, Service account is selected, the JSON key is pasted or the key file is chosen, and the Cloud project id is set. In the event that the said field is left blank, the project_id carried inside the key is the one utilized. The service account must already be registered for Earth Engine, and the Earth Engine API must be enabled on its corresponding project. Google sign-in is not required under this option.
For a hostname that is publicly reachable, GEE_OAUTH_REDIRECT_URI is set to https://your-host/auth/gee/callback, that URI is registered on the OAuth client, and CSRF_TRUSTED_ORIGINS is set to https://your-host. BEHIND_PROXY=1 is set in the case where a reverse proxy is the component terminating TLS.
A request may be phrased in the following manner: NDVI of Barangay San Antonio, Makati
The indices presently supported are NDVI, EVI, SAVI, and NDMI. The composites are true color, false color, agriculture, and geology. The assistant resolves the place name against the boundary files and draws the corresponding boundary on the canvas. Should more than one unit match the name given, it asks which of them is intended. Should no date be supplied, it asks for one. A reply written as a day, for instance 2024-03-15, is sufficient. Imagery is then requested for a window around that day. An index returns the mean value and places a colored raster on the canvas. A composite places the color image.
At barangay level the source is Sentinel-2 at 10 m. At municipality level the source is Landsat 8/9 at 30 m. At province or region level the source is MODIS at 500 m.
GeoParquet files are placed in data/boundaries/ or in resources/ph_bounds/. Both directories are mounted into the container, and data/boundaries/ is the one inspected first. Where none of the recognized files are already present, init.sh and docker compose up download the boundary archive and extract it into data/boundaries/, or into BOUNDARY_DIR when that variable is set. Where a new extract carries column names other than those already known, the mapping for the same is adjusted in backend/gis_tools/schema.py.
The application will still start in the event that the folder contains no files. Lookup will then report that no boundary file has been loaded.
The files are read on first use, so a restart is not required for a file that has just been added. The loader detects a .parquet file that is new or that has been replaced.
The directories below are tried in the order listed, and the first one that matches is the one utilized:
BOUNDARY_DIR, if you set itdata/boundaries/resources/ph_bounds/ (the files already in this repo)Per-level files
| Level | Names |
|---|---|
| region | regions.parquet, reg_bound.parquet, reg_boundary.parquet |
| province | provinces.parquet, prov_bound.parquet, prov_boundary.parquet |
| municipality | municipalities.parquet, muni_bound.parquet, cities.parquet, mun_boundary.parquet |
| barangay | barangays.parquet, brgy_bound.parquet, brgy_boundary.parquet |
A single combined philippines.parquet carrying a level column may also be used. Where the per-level files and the combined file are both present, the per-level files take precedence.
Columns
A generic file is expected to carry name, code, parent_name, parent_code, level, and a GeoParquet geometry column.
The Philippine extract under resources/ph_bounds uses the columns listed below:
Reg_Name, area_ha, geometryProv_Name, Reg_Name, area_ha, geometryMun_Name, Prov_Name, Reg_Name, area_ha, geometryBrgy_Name, Mun_Name, Prov_Name, Reg_Name, id_, area_ha, geometrygeometry_bbox, when the column is present, is what the spatial index reads, so that it does not have to open every polygon.
In order to direct the loader at a different set of column names, the change is made in backend/gis_tools/schema.py.
backend/static/js/ — the page, the chat, the map, and settingsbackend/chat/agent.py — the tool-calling loopbackend/llm/providers.py — OpenAI, Anthropic, xAI, Google, OpenRouter, and a custom OpenAI-compatible base URLbackend/gis_tools/ — boundary lookup, the grouped index and composite tools, and the registrybackend/gee/ — Google sign-in and Earth Engine credentialsGET /api/tools and POST /api/tools/<name> — the same tools exposed over HTTP/mcp — the same tools exposed over MCPA tool is added by writing a module under backend/gis_tools/, registering a ToolSpec for it, and importing that module from registry.ensure.
Tailwind and Leaflet are loaded from CDNs. The browser therefore requires a network connection for the interface itself, for the OpenStreetMap basemap, and for the Earth Engine tiles. LLM keys are not kept in .env.
Further static files, among them fonts, icons, and a local copy of Leaflet, may be placed in backend/static/vendor/. As it stands, the page loads Tailwind and Leaflet from their respective CDNs.