Under the Hood: How Geo-Cells Connect You
One of the most frequent questions we get is: "How do you know who is near me without tracking where I am?" The answer lies in a concept called Geospatial Lattice Mapping, or as we call them, "Geo-Cells".
The Privacy Paradox
Traditional location apps work by sending your exact latitude and longitude (e.g., 37.7749, -122.4194) to a central server. The server then calculates the distance between you and every other user using the Haversine formula.
The problem? To do this, the server must know exactly where you are at all times. This is a privacy nightmare. We wanted a system where the server works blind—connecting people without ever knowing their precise location.
The Solution: The 4-Decimal Grid
Instead of sending raw coordinates, GPS Clipboard performs a "rounding" operation on your device before any data leaves your phone.
- Raw Latitude: 37.7749281 (Pinpoints you to a specific chair)
- Rounded Latitude: 37.77 (Pinpoints you to a city block)
By truncating coordinates to roughly 3-4 decimal places, we create a discrete "Bucket" or "Cell".
How the Algorithm Works
// Simplified Geo-Cell Calculation
function getGeoCell(lat, lon) {
// Round to ~11 meters precision
const latGrid = Math.floor(lat * 10000);
const lonGrid = Math.floor(lon * 10000);
// Create a unique string ID for this box
return `cell_${latGrid}_${lonGrid}`;
}When you post a message, your phone says: "I am in Box #8492. Here is a message for Box #8492."
The server simply stores the message in Box #8492. It has no idea where inside that box you are, or who else is there. It just acts as a dumb mailbox for that specific grid ID.
Why this matters for Speed
Privacy aside, this approach is incredibly fast. Calculating distances between thousands of users is computationally expensive ($O(n^2)$ complexity).
With Geo-Cells, looking up messages is an $O(1)$ operation. We just look up a single database key. This is why messages appear instantly, even if thousands of people are using the app simultaneously.
The "Border Problem"
What if you are standing exactly on the line between two cells? You might be 1 meter away from your friend, but if the invisible grid line separates you, you won't see their messages.
To solve this, our client actually subscribes you to your current cell plus the 8 surrounding neighbor cells. This ensures that even if you drift across a boundary, you stay connected to everyone in your immediate vicinity.
Did you know?
This same logic is used by ride-sharing apps to find nearby drivers and by video games to load localized maps. It’s a battle-tested pattern for high-performance spatial computing.
If you're curious, open multiple incognito windows side-by-side or ask a colleague in the same room to open Local Share. You'll see the magic of geo-cells matching you instantly over WebSockets.
Hemanth Reddy
Founder & Lead Developer
Hemanth is a passionate software engineer focused on building privacy-first communication tools. He created Local Share to solve the problem of quick, anonymous local networking without the friction of app downloads.