Bringing Precision Back to Linux Location Services with a Local GPS Server

Introduction

Modern applications and websites increasingly rely on location services to determine where you are, saving you the hassle of manually entering coordinates or addresses. But when those services lose accuracy, the convenience quickly fades. For Linux users, the shutdown of the Mozilla Location Service (MLS) in 2024 dealt a heavy blow to the Geoclue location framework, dropping its resolution from something useful to a vague area of about 25 kilometers. However, a clever workaround has emerged: broadcasting a static set of GPS coordinates over the local network to restore precise location data.

Bringing Precision Back to Linux Location Services with a Local GPS Server
Source: hackaday.com

The Problem: Geoclue's Loss of Precision

Geoclue is a key component in many Linux desktop environments, providing location data to applications like Gnome Maps, Firefox, and various mapping tools. It traditionally relied on the Mozilla Location Service (MLS) to obtain accurate coordinates based on Wi-Fi and cell tower data. When MLS was discontinued in 2024, Geoclue's fallback methods left users with a resolution of roughly 25 km—essentially useless for pinpointing a street address or house.

For a local area network (LAN) that remains stationary (like a home or office), this problem is particularly frustrating. The network itself doesn't move, yet the location service treats it as if it could be anywhere within a 25-km radius. Something had to give.

A Clever Solution: Broadcasting NMEA Data Over LAN

Developer Evert Pot realized that Geoclue can accept location data from a trusted local source on the network. Specifically, Geoclue listens for an mDNS service that advertises itself as _nmea-0183._tcp. This service must respond with GPS coordinates formatted as ASCII payloads following the NMEA 0183 standard—the same protocol used by marine GPS units and many embedded devices.

This opened the door to a simple but effective fix: set up a minimal Python server on the LAN that continuously broadcasts the network’s known, static GPS coordinates. The server doesn’t need to connect to any external service—it just repeatedly sends the same NMEA sentences, effectively pretending to be a permanent GPS receiver at that location.

How the Python Server Works

Evert’s implementation is straightforward. It registers an mDNS service with the required type (_nmea-0183._tcp) and then emits NMEA 0183 formatted strings (typically $GPGGA or $GPRMC sentences) containing the latitude, longitude, altitude, and timing information. Because the LAN stays in one place, the server can just replay the same data indefinitely.

Bringing Precision Back to Linux Location Services with a Local GPS Server
Source: hackaday.com

This approach works without any hardware GPS receiver—the coordinates are simply hardcoded or retrieved from a configuration file. The server runs on any machine on the local network (a Raspberry Pi, a desktop, or even a container) and makes itself discoverable via mDNS (also known as Bonjour or Avahi).

Testing and Results

With the server active, Evert tested the setup on multiple systems. Gnome Maps immediately locked onto the correct location, down to the exact house. Firefox with Google Maps also displayed the precise address. The screenshots from his experiments show a crisp, accurate map pin, a stark contrast to the 25-km blob that Geoclue had been returning.

MacOS and Apple Maps: A Different Story

Interestingly, the same LAN service did not work with Apple Maps on a Mac unless the system’s Location Services were completely turned off. This suggests that Apple relies on its own proprietary equivalent of MLS, disregarding local NMEA sources when location services are active. Once disabled, however, Apple Maps fell back to the nearest available network-based location—which, in the presence of the mDNS server, became the accurate coordinates.

Conclusion

Evert Pot’s solution elegantly fills the gap left by the Mozilla Location Service shutdown. By running a lightweight Python server that broadcasts static GPS coordinates over the LAN, Linux users can restore pinpoint accuracy to Geoclue-dependent applications. While not a universal fix—mobile devices or systems that move around won't benefit—it’s perfect for homes, offices, and any fixed network where location is predictable.

If you’re experiencing the Geoclue accuracy drop, consider setting up your own local NMEA broadcast. It’s a simple, self-hosted approach that puts location control back in your hands, no cloud service required.

Tags:

Recommended

Discover More

7 Key Insights from the $10,000 Bet on Self-Driving Cars by 2030CoreWeave Stock Tumbles 8% After Hours on Weak Revenue Forecast and Surging Capex PlansBoosting Web Performance: How Explicit Compile Hints Speed Up JavaScript in ChromeNSW Accelerates Green Energy Approvals to Ditch Coal and Keep Smelter RunningHow to Leverage Mistral's New Remote Agents and Work Mode in Le Chat