Golf cart GPS tracking software should alert when several fixes in a row sit outside a radius around the lock point, after each fix's reported accuracy is subtracted. One bad fix is drift; a streak is a move. Axons Mobility is golf cart and LSV fleet management software, based in Dubai, UAE, for cart makers, dealers and fleet operators.
This tutorial builds that rule in about 40 lines of Python, runs it on two sample tracks, and lists what to check before trusting a theft alert in production.
Why does a parked golf cart seem to move on the map?
Because every GPS fix is an estimate with an error radius, and the error changes from fix to fix. A cart that has not moved can still appear to wander several metres, sometimes far more.
GPS.gov says GPS-enabled smartphones are typically accurate to within a 4.9 m (16 ft) radius under open sky, and that what you receive depends on satellite geometry, signal blockage, atmospheric conditions and receiver quality. That is the good case. A cart tracker under a roof, in a charging bay or beside a clubhouse wall sees less sky and picks up reflected signals (multipath), so it can report worse.
Most trackers also report how sure they are, as a horizontal accuracy value in metres. A naive rule, "alert if the cart is more than X metres from where it was locked", ignores that number and wakes the night guard whenever a reflection throws one fix 40 m into the car park. The rule must use the reported accuracy, not only the coordinates.
How do you tell GPS drift from a real move?
Read several signals together instead of one position. Drift is noisy and comes back to the lock point; a real move is consistent and keeps going.
| Signal | What drift looks like | What a real move looks like |
|---|---|---|
| Distance from the lock point | Small, or one large jump that comes back | Grows fix after fix |
| Reported accuracy | Often poor (large radius) on the fixes that jump | Usually normal once the cart is in the open |
| Consecutive fixes | One or two outliers, then back inside | Three or more in a row outside the radius |
| Speed and heading pattern | Random direction, impossible speeds, no path | Steady heading, plausible cart speed, follows a path |
| Lock state from the cart's device | Still locked, no ignition or motion event | May show unlock, ignition or motion, or no change if the cart is towed |
Not every device reports every row. Some send no lock state, some no heading. The rule below needs only time, position and reported accuracy, so it runs on the smallest common set of data.
What rule should trigger a locked-cart alert?
Alert when a set number of trusted fixes in a row sit outside a radius around the lock point, even after each fix's own error is subtracted. Skip fixes whose reported accuracy is too poor to judge.
from dataclasses import dataclass from math import radians, sin, cos, asin, sqrt @dataclass class Fix: t: int # seconds since lock lat: float lon: float accuracy_m: float # reported horizontal accuracy (radius) def distance_m(a_lat, a_lon, b_lat, b_lon): """Haversine distance in metres.""" r = 6_371_000 dlat, dlon = radians(b_lat - a_lat), radians(b_lon - a_lon) h = sin(dlat / 2) ** 2 + cos(radians(a_lat)) * cos(radians(b_lat)) * sin(dlon / 2) ** 2 return 2 * r * asin(sqrt(h)) def locked_cart_moved(anchor, fixes, radius_m=25, max_accuracy_m=15, needed=3): """Return the time of the alert, or None. anchor: (lat, lon) where the cart was locked radius_m: how far a fix must be from the anchor to count max_accuracy_m: fixes with a worse accuracy are ignored (drift, multipath) needed: how many counting fixes in a row before we alert """ in_a_row = 0 for f in fixes: if f.accuracy_m > max_accuracy_m: continue # do not trust it, and do not reset the streak d = distance_m(anchor[0], anchor[1], f.lat, f.lon) # the fix must be outside the radius even after its own error is taken off if d - f.accuracy_m > radius_m: in_a_row += 1 if in_a_row >= needed: return f.t else: in_a_row = 0 return None if __name__ == "__main__": anchor = (25.0800, 55.1400) m = 1 / 111_320 # about one metre of latitude in degrees drift = [Fix(t, anchor[0] + dm * m, anchor[1], acc) for t, dm, acc in [(60, 4, 5), (120, 9, 8), (180, 40, 35), (240, 6, 6), (300, 12, 9)]] stolen = [Fix(t, anchor[0] + dm * m, anchor[1], 6) for t, dm in [(60, 3), (120, 30), (180, 70), (240, 120), (300, 180)]] print("drift ->", locked_cart_moved(anchor, drift)) print("stolen ->", locked_cart_moved(anchor, stolen)) The three parameters:
-
radius_m(default 25): how far from the anchor a fix must be to count. Set it larger than the cart's normal parked wander at that site. Too small and drift counts; too large and a cart is well down the path before anyone knows. -
max_accuracy_m(default 15): fixes with a reported accuracy worse than this are ignored. They neither add to the streak nor reset it, because a fix you do not trust is not evidence in either direction. -
needed(default 3): how many counting fixes in a row are required. This is the trade between false alarms and delay: with one fix a minute,needed=3means about three minutes of sustained movement.
The line doing the real work is d - f.accuracy_m > radius_m. A fix 30 m away with 6 m accuracy could really be 24 m away, so the code treats it as 24 m. One caution: devices define accuracy differently (different confidence levels, or only a dilution-of-precision figure), so check what your device's number means before choosing max_accuracy_m.
How do you test the rule?
Replay recorded fixes through it and check both outcomes: a parked cart with drift must stay silent, and a cart that leaves must alert. The script prints:
drift -> None stolen -> 300 In drift, the 40 m jump at 180 s arrives with 35 m accuracy, so it is skipped. Every other fix is inside the radius. No alert.
Why does stolen alert at 300 s and not 120 s? At 120 s the fix is 30 m away, but with 6 m accuracy the trusted distance is 24 m, under the 25 m radius, so the streak resets. It then counts 180, 240 and 300, and the third counting fix raises the alert.
Then use real data. Export a few nights of fixes from carts you know stayed parked, and a few tracks where staff moved a locked cart on purpose. Count false alerts on the first set and seconds-to-alert on the second. Also test the blind spot: if every fix has poor accuracy the rule never fires, so add a separate "no trusted fix for N minutes" warning.
What should golf cart GPS tracking software do after the alert?
Show the last trusted position on a live map, notify a named person, and keep recording the track. An alert nobody can act on is just a log line.
Send the alert once, not on every later fix. Include the distance, the reported accuracy and the time of the first counting fix, so the person on duty can judge it in seconds. Keep the full track as evidence and do not clear the alert automatically when the cart stops.
In Axons Mobility, a locked cart that starts moving raises an alert with its last place on the live map, and every ride can be replayed with Ride Replay. It is golf cart GPS tracking for resorts and courses that works with the devices already on the carts, any brand, and what a cart can do depends on its device.
What should buyers ask a vendor?
Ask how the alert is decided, not whether one exists. These questions separate a tuned rule from a raw distance check:
- Does the theft alert use the device's reported accuracy, or only the coordinates?
- How many consecutive fixes are needed before an alert, and can we change that per site?
- Can the radius be set per parking area, for example covered bays versus open lots?
- How often does a locked cart report its position, and does the rate rise when it moves?
- What happens when a cart has no trusted fix, or no signal, for a long period?
- Does the software read lock, ignition or motion events from our existing devices, and which ones?
- Can we replay the full track of an alerted cart afterwards and export it?
Next step: run the function on your own fix logs. Tune radius_m, max_accuracy_m and needed for each site, because a covered cart barn and an open car park do not drift the same way.
Tejal Laxkar is Co-founder & Director at Axons Mobility, Dubai.