When basic dating apps couldn't work, people created apps to find people nearby you. But how would you design a system like that? Basically, building a service like yelp - finding best restaurants can be approached with building quadtrees. But, the approach works for it because there are no location updates for restaurants. But, finding nearby people is whole another thing. People change location quite frequently. You can't just keep creating new quadtrees. 1. Efficient Location Updates (Writes) Users periodically send their GPS coordinates. The backend maps each location to a fixed spatial cell using a geohash (or S2 cell). → Updates only move a user between cells if they cross boundaries, avoiding unnecessary writes. 2. Static Spatial Indexing Rather than building a new quadtree on each update, the world is divided into a precomputed grid of spatial cells. → Each cell maps to a small set of users, stored in memory (e.g., Redis) or a spatial DB like PostGIS. 3. Proximity Queries (Reads) When looking for nearby friends, we query the user’s current cell + adjacent cells — drastically reducing the search scope. → Final filtering uses Haversine or built-in geo operators for accuracy. 4. Real-Time with Scale The system supports both pull-based fetching (e.g., refresh nearby list) and push-based notifications using WebSockets/pub-sub when friends enter a zone. → Each region can be sharded for scalability. 5. Privacy-First Design Users control who can see their location (full access, limited, or time-bound sharing). Location data is encrypted and access-controlled at every level. This pattern allows fast lookups, minimal writes, and constant-time updates — no need to rebuild spatial indexes dynamically. Would love to hear how others have balanced precision, scale, and privacy in similar real-time systems. #SystemDesign #BackendArchitecture #Geolocation #Redis #PostGIS #Geohash #ScalableSystems
Location-Based Services in Apps
Explore top LinkedIn content from expert professionals.
Summary
Location-based services in apps use real-time geographic data from users’ devices to deliver personalized features—like finding nearby people, tracking deliveries, or suggesting routes. These technologies help apps connect users with relevant local information and make navigation or interactions more convenient and customized.
- Improve real-time accuracy: Choose app designs that process location data on the device, keeping position updates fast and reliable even in areas with spotty cell service.
- Customize user experience: Build extra features beyond basic mapping, such as grouping orders or picking the nearest driver, to address unique business needs and stand out from competitors.
- Protect user privacy: Give users clear control over when and with whom they share their location, and use encrypted data storage to keep personal information secure.
-
-
When I started at Grab in 2016, simply putting a vehicle on a map was revolutionary. Nine years later, that basic feature is table stakes—here's where the real innovation is happening now: Tracking capabilities and ETAs on smartphones using APIs, algorithms, or platforms are widespread and standard fare. The market is saturated with mapping companies, fleet telematic companies, and location tech companies offering these basic capabilities. OSRM, Valhalla, Google, Mapbox, and others. Now that these services are somewhat commoditized and become common knowledge, the biggest thing we see is people wanting more than basic location services. Companies are looking to build on top of existing infrastructure to provide advanced route optimization for greater efficiency and a better customer experience. Things like: • Which driver should do a pickup based on their current position? • How should orders be grouped? • Which fleet of vehicles should do the deliveries? • How should e-bikes, scooters, and motorcycles be leveraged? Google Maps and other open source projects aren’t tailored enough to leverage unique advantages for specific use cases. Tracking, mapping, and real-time visibility are, from a consumer perspective, table stakes. Customers want added features on top that offer more sophisticated and customized functionality. Google Maps did the groundwork to make location service capabilities widespread. The next level is about solving a unique operational challenge in a particular industry for a specific problem to create a greater competitive edge and better business outcomes.
-
Developing Fast-Delivery Apps Like Zepto, Swiggy Instamart, and Blinkit: Technology Stack and Architecture 1. Frontend Technologies: Leverage modern frameworks like React, Angular, or Flutter to create a responsive, intuitive user interface. 2. Backend Technologies: Use powerful frameworks such as Node.js, Ruby on Rails, or Django to manage core functions like orders, inventory, and delivery logistics. 3. Geolocation and Mapping: Integrate with services like Google Maps or OpenStreetMap for precise location tracking, route optimization, and real-time delivery updates. 4. Messaging and Notifications: Implement seamless communication using WebSockets, Firebase Cloud Messaging, or Amazon SNS for real-time alerts between users, drivers, and the app. 5. Payment Processing: Secure transactions through trusted gateways like Stripe, Braintree, or PayPal. 6. Data Storage and Analytics: Combine relational (MySQL, PostgreSQL) and NoSQL (MongoDB, Cassandra) databases for effective data management. Incorporate analytics for actionable insights and performance optimization. 7. Scalability and Reliability: Design for scale with cloud infrastructure, load balancing, and containerization tools like Docker and Kubernetes, ensuring high availability and smooth performance.
-
With over 22 million active riders, Lyft’s biggest struggle was translating the moving and spotty GPS signals from drivers into actual map apps. Earlier, Lyft used server-side processing for this problem but later switched to a client-side (on-device localization) process, which better served them. Here’s why Lyft made the move. Let’s break it down. ► What was the problem exactly? Lyft faced challenges with unreliable and noisy GPS signals, which led to inaccuracies in driver and rider location tracking. Initially, map matching was handled on the server side, but this approach had limitations in handling latency and accuracy. ► Why Lyft Made the Switch? - On-device localization allows faster and more accurate location updates by processing data directly on the device. - It enables Lyft to continue providing accurate navigation and rerouting services even when drivers lose cell reception, such as in tunnels or remote areas. - The new system reduces dependency on server-side computations, simplifying the overall server architecture and reducing operational costs. ►Benefits of the New Process 1. 𝐈𝐭 𝐡𝐞𝐥𝐩𝐬 𝐢𝐦𝐩𝐫𝐨𝐯𝐞 𝐧𝐚𝐯𝐢𝐠𝐚𝐭𝐢𝐨𝐧: a). By understanding the road network and its features, rerouting and off-route detection algorithms can be improved. b). Cell network availability is not guaranteed. With map data available on-device, Lyft can localize and reroute drivers when they are offline (for example, in tunnels or rural areas). 2. 𝐈𝐭 𝐡𝐞𝐥𝐩𝐬 𝐢𝐦𝐩𝐫𝐨𝐯𝐞 𝐥𝐨𝐜𝐚𝐭𝐢𝐨𝐧 𝐭𝐫𝐚𝐜𝐤𝐢𝐧𝐠: a). Map matching on-device improves the freshness of localization models. b). Moving high-cost computation from server to client simplifies server-side architecture, reduces hosting costs, and lowers server-to-client latency. c). Direct access to high-frequency sensor data improves localization quality. 3. 𝐈𝐭 𝐡𝐞𝐥𝐩𝐬 𝐛𝐮𝐢𝐥𝐝 𝐬𝐚𝐟𝐞𝐭𝐲 𝐟𝐞𝐚𝐭𝐮𝐫𝐞𝐬 𝐟𝐨𝐫 𝐝𝐫𝐢𝐯𝐞𝐫𝐬: a). Notifying drivers of unauthorized drop-off and pick-up areas based on curb features. b). Displaying speed limits. c). Showing map elements like traffic lights and stop signs.