Zones as data
Store delivery zones as GeoJSON polygons in their own collection, with fields such as fee or depot. Update a zone by writing the object again — no deploy needed.
Decide instantly which zone, depot, or pricing area an address belongs to, and notify customers and dispatchers the moment a driver arrives at a stop or leaves the hub.
Last-mile delivery runs on geography. Checkout needs to know whether an address is serviceable and which zone's fee applies. Dispatch wants to know when a driver leaves the hub and reaches each stop. Customers expect an "arriving now" message at the right moment — not five minutes late because a job only polls every few minutes.
Zones change often, notifications must not get lost, and the same events usually need to reach several systems.
Store delivery zones as GeoJSON polygons in their own collection, with fields such as fee or depot. Update a zone by writing the object again — no deploy needed.
intersects with a GeoJSON point returns the zones that contain an address, including their fields, in a single request.
Register each hub or customer site as a geofence hook. latlng sends an enter event when a driver arrives and an exit event when they leave.
Geofence queries accept field filters, so a stop's fence can ignore vehicles that are parked or on another route.
Webhook jobs are written to the durable log with the position update, retried with exponential backoff, and dead-lettered instead of dropped.
Every delivery carries stable X-LatLng-Event-Id and X-LatLng-Job-Id headers, so your notification service can safely ignore repeats.
Your shop calls latlng with the geocoded address to find the zone and its delivery fee.
Driver apps send positions with the current route and status as fields.
Hub and stop geofences emit exit and enter events as drivers move.
Your notification service turns webhooks into SMS, push, or email — once per event.
Store zones as polygons, then look up a geocoded address with a single intersects query.
# Store a zone with its delivery fee
curl -s -X POST http://127.0.0.1:7421/collections/zones/objects/zone-mitte \
-H 'content-type: application/json' \
-d '{
"object": { "GeoJson": { "type": "Polygon", "coordinates": [[
[9.96, 53.54], [10.03, 53.54], [10.03, 53.57], [9.96, 53.57], [9.96, 53.54]
]] } },
"fields": [ { "name": "fee", "value": { "type": "number", "value": 1.5 } } ]
}'
# Look up a geocoded address
curl -s -X POST http://127.0.0.1:7421/collections/zones/search/intersects \
-H 'content-type: application/json' \
-d '{ "area": { "GeoJson": { "type": "Point", "coordinates": [9.9937, 53.5511] } },
"options": { "output": "Ids" } }'
# {"count":1,"cursor":0,"results":[{"id":"zone-mitte","fields":{"values":{"fee":{"type":"number","value":1.5}}}, ...}]} Register a polygon geofence, receive enter and exit events over HTTP, and handle retries and duplicate deliveries.
Beginner · 15 min Build a real-time vehicle trackerCreate a fleet, register vehicles with status fields, stream position updates, and find the nearest available vehicle.
Intermediate · 10 min Stream live geofence events over WebSocketUse channels and the TypeScript SDK to push enter and exit events to a backend service or dashboard in real time.
Store your delivery zones as GeoJSON polygons in a collection, geocode the address, and run an intersects query with a GeoJSON point. The response lists every zone that contains the point, along with fields such as the delivery fee.
Register the stop as a geofence hook that detects enter events. When the driver's position update crosses the boundary, latlng sends a webhook to your notification service, which messages the customer.
Webhook jobs stay in latlng's durable queue and are retried with exponential backoff. After the configured retry budget they move to a dead-letter state, which you can monitor through the admin endpoint and Prometheus metrics.
Yes. Register several hooks with the same geofence and different endpoints, or have one receiver fan events out to the systems that need them.
Organize vehicles into fleets, track live positions and status, find the nearest available vehicle, and get alerts when vehicles enter or leave depots.
Ride-hailing and on-demand dispatchMatch riders with the nearest available driver, alert when a driver is close to the pickup, and manage airport and event pickup zones.
Asset tracking and theft alertsKeep track of trailers, containers, and equipment across sites, raise an alert when an asset leaves its yard, and detect trackers that stop reporting.