Over the weekend, I started playing with WebAssembly (Wasm) and WebGPU to see what it would take to run a language model directly in the browser. DuckDB already runs there through DuckDB-Wasm, so I wondered what would happen if I put the two together. Could I ask a map a question in plain language and have both the model and the spatial query run in the same browser tab? It seemed like a good excuse to try a little light GeoAI.
I built a demo app called HIFLD Next Explorer to browse public infrastructure data on a map and ask questions about it in plain language. Both LLM inference and tool calling stay in the browser. I’d worked with HIFLD data before, so it was a natural place to start.
The data comes from HIFLD Next, a catalog that hosts an archive of HIFLD (Homeland Infrastructure Foundation-Level Data) Open. The U.S. Department of Homeland Security used HIFLD Open to share public GIS layers on infrastructure and resilience. When that portal went offline, the Data Rescue Project preserved the collection. Public Environmental Data Partners and Fulton Ring launched HIFLD Next to make more than 400 of those layers available to browse and download in formats including GeoParquet, geopackage, and GeoJSON.
GeoParquet gave me a direct way to use the archive in the demo. DuckDB-Wasm loads the files into local tables for spatial queries, and MapLibre displays the layers over an OpenStreetMap basemap.
The demo uses Llama 3.1 8B, the smallest model in Meta’s Llama 3.1 family at eight billion parameters. WebLLM runs the model in the browser, with WebGPU doing the inference work on the user’s GPU. The LLM has a narrow job here. It takes the question, the active layer’s schema and metadata, and relevant context from the map and recent conversation, then returns a structured query plan as JSON.
With the map centered on the Washington, D.C., area, I asked, “Show me aviation facilities within 5 miles of Amtrak stations.” The model proposed a spatial join between two loaded layers, Aviation Facilities and Amtrak Stations. The app checked the plan against the available layers and supported operations, compiled it into parameterized, read-only SQL, and ran it in DuckDB. The LLM did not supply the SQL, though I plan to try that in a future iteration.
With the current-view toggle on, DuckDB searched for aviation facilities within the map bounds captured when I submitted the question. It still checked those facilities against the full Amtrak Stations layer, so a station just outside the view could still count. The query returned 31 distinct aviation facilities, and the app highlighted all 31 in orange without changing either source layer.

I should note that running in the browser doesn’t mean the app is offline. It still uses the network to fetch resources such as model weights, datasets, and map tiles. Once those are available, the model interprets the question and DuckDB does the analysis without sending the prompt or the query to a remote service. The initial load of the LLM can take quite a while. After that, it loads from cache and is quite fast.
This could be an approach to consider when digital sovereignty matters. Even if the underlying data is public, a question about what’s near a particular facility can reveal an organization’s priorities. Keeping that question and the analysis in the browser gives the organization more control over what it shares with outside services.
The same approach can help protect sensitive data. If the app, model weights, datasets, and map tiles are served from inside a protected enclave and the browser runs there too, the data, prompts, and results can all stay inside that boundary.
It can also reduce the infrastructure needed to run the app. The user’s machine handles inference and spatial queries, so there’s less need to provision a central backend to do that work. Even in situations where Frontier models are sometimes needed, this approach can offload routine work and conserve token spend.
If you’d like to see how it works, the source code is on GitHub.