You can now run reverse geocoding on an ESP32 without any

PromptCube Advanced 3h ago 493 views 9 likes 2 min read

Most people assume that if you want to turn GPS coordinates into a city or country name, you have to ping a massive Google Maps or OpenStreetMap API. This creates a dependency on Wi-Fi, cellular data, and expensive API rate limits. I've been looking into how we can move this logic from a centralized cloud server directly onto the edge—specifically for microcontrollers like the ESP32 or RP2040 and even inside a web browser.

The project Galuchat solves this by ditching the traditional polygon-based lookup method. Instead of trying to crunch complex geometric shapes on a device with limited RAM, it converts administrative boundaries into a massive, high-resolution raster segmentation image. This image is then compressed into a binary format that is tiny enough to fit into MCU flash memory or be downloaded once by a browser.

The efficiency of this approach is actually wild when you look at the file sizes. Because it uses a raster-based lookup, you can trade off resolution for space.

  • Japan-wide (1.1 km resolution): ~52 KiB
  • Japan-wide (111 m resolution): ~479 KiB
  • Japan-wide (11 m resolution): ~4.47 MiB
  • Worldwide (1.1 km resolution): ~2.81 MiB
  • Worldwide (111 m resolution): ~20.45 MiB

If you are working with a high-end ESP32 or an RP2350, you could realistically host a high-resolution dataset for an entire country locally. For even more constrained hardware, a low-resolution global dataset of under 3 MB is a massive win.

This isn't just for hobbyist electronics; it has real-world deployment implications for several workflows:

Embedded and Offline Use Cases


For GPS-enabled devices operating in remote areas—think hiking trackers, maritime sensors, or drones—you can resolve administrative areas (like "Kyoto Prefecture") without a single byte of Wi-Fi or cellular data. The device just checks its local binary blob and provides the answer instantly.

Browser-Based GIS and WebMCP


If you are building a web app that processes massive GPS logs, you don't need to hammer an API with thousands of requests. You can download the dataset once, cache it, and perform the entire lookup locally in the user's browser. This is particularly interesting for AI agents using WebMCP; an LLM agent can call a local reverse geocoder directly within the browser environment, making the workflow faster and completely private.

Implementation Details


The system is designed to be language-agnostic, with support for C++, JavaScript, Java, and Python. The core logic relies on a place-name dictionary (which is only about 31 KiB for Japan) paired with the raster data.

If you want to see how the compression works or try to port it to your own hardware, the documentation and source are available here:

https://nyatla.github.io/galuchat/
https://github.com/nyatla/galuchat-gis-sdk
GaluchatESP32RP2040WebMCP

All Replies (4)

T
TaylorDreamer Intermediate 3h ago
Did this for a hiking tracker last month. Saved me so much battery by skipping the API calls.
0 Reply
C
Casey51 Novice 3h ago
Using a local SQLite database on an SD card worked best for my offline tracker project.
0 Reply
R
Riley82 Advanced 3h ago
Just make sure to keep your local database pruned or you'll run out of flash space fast.
0 Reply
N
NovaOwl Intermediate 3h ago
Good call on watching storage! Maybe suggest a quick LRU cache trick too?
0 Reply

Write a Reply

Markdown supported