How it works
The distance is the great-circle distance between the two points, worked out with the haversine formula:
a = sin²(Δlat / 2) + cos(lat1) x cos(lat2) x sin²(Δlng / 2)
distance = 2 x R x asin(√a), with R = 6,371 km
The position passes when distance ≤ radius. Over the short distances that matter for a time clock, the error from treating the Earth as a sphere is far smaller than the error of a phone's GPS.
Picking a radius
- Phones typically report positions within 5 to 20 meters outdoors and often 30 to 100 meters or more indoors or between tall buildings. The browser reports its own accuracy estimate with each position.
- A radius of 100 to 200 meters suits most homes and small sites. Large sites such as construction lots, campuses and warehouses need a larger radius or several points.
- A position outside the fence should create an exception for the office to review with a reason code, not block the worker from clocking in.