Ghawken / IndigoPlugin-iFindFriendMini

iCloud FindmyFriends Plugin for Indigo. Bypasses 2FA issues. Enables Friend tracking, mapping and Geofencing updates/triggering from icloud location servers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incorporate Horizontal Accuracy into entering or leaving geofences

Ghawken opened this issue · comments

Horizontal accuracy appears to give a figure in meters of the accuracy of the current GPS location. If the location accuracy is very poor eg. 1600; this gives a very wide circle of location.

This appears to cause Geofence to trigger entry if within 1600m of Geofence. Depending on where the center of this large circle is located.

Should incorporate this accuracy into exit/enter and exit/arrival times.

How to?
Option 1:Could ignore everything over a certain accuracy figure ?400 or so. Unless reasonable accurate don’t use result. If ended up on other side of world though - would still be obvious that should have exited a Geofence.

Edit: probably best option is to have combined factor of Geofence range/accuracy. If massive geofence accuracy less important provided still within, if smaller geofence accuracy more important - probably by a factor of size geofence.

Eg.
Geofence range 100/accuracy 100. Percent 100%. Or subtraction hmmm.
Distance apart result: 20. Subtraction 0. Accuracy 100.
So result might be 120m apart. ==120/100 = 1.2
Or
20-100 = -80. Range 100. OK

Geofence range 100/accuracy 1000. Percent 10%. Might be, but good chance not
Distance apart result: 500. Still within possible result.
Subtraction 900. Result 1000m accuracy.
May be 1500m apart. (Reasonable)
Result =1500/100. == 15
OR
500-1000m= -500. range 100. Not within

Geofence range 1000/accuracy 1000. Percent 100. Good again
Distance apart 500. Accuracy 1000.
Result might be 1500.
= 500+1000/1000 =1.5
Or
500-1000 =-500. Range

Geofence range 100/accuracy 1600. Percent 1/16. Pretty low.
Distance apart result 10. Subtract 1500. Accuracy is 1.6km
Result may be 1610.
= 1610/100 = 16.1
10-1600 = -1590 versus range 100
Not within

Geofence range 1000/accuracy 2000. Distance apart 250
= 2250/1000=2.25
Or
250-1000 = -750 within range 1000
Or distance apart 2000m
2000-2000 =0. Within range.
Or distance apart 3000m
3000-2000 = 1000. Just within range.
Likewise distance apart 2500
2500 -2000 = 500. Range 500, so fine.

Geofence range 5000/accuracy 2000. Distance apart 500.
= 2500/5000 = 0.5
Or
500-2000 = -1500 within 5000 range

= distance apart+accuracy/geofence range.
Give reasonable factor to use.
?2 as starting point

OR
Best Option: Use for ever enter or exit Geofence:

(Distance Apart-Accuracy) < Geofence Fence Range.

If less than may be within Geofence, if greater than will not be.
?use this for all Geofence enter/exit....

& perhaps also:

Option 2:
Restrict exit (if in Geofence) and entry (if not in Geofence) to reasonable accurate readings only.

Option 3: calculate circles of interesection and depending how close use or not use. Still doesn’t overcome the core issue which is if gps data unreliable gps data is unreliable.

Other aspects:
Range of Geofence:
If tight eg. 20 m - need accuracy to enable arrive/exit
If wide eg 1000m - obviously less accurate

An improvement but still difficult to properly deal with accuracy.

More code changes needed

Change to use ratio of Accuracy to geofence Range and only then use entry/exit of Geofence
Ratio currently of 2.
Will only set entry/exit geofence events and triggers if accuracy versus geofence range is less than 2
e.g.
Geo range of 100m. Accuracy is 1000m. (poor) Ratio = 10 won't entry/exit until more accurate reading
Geo of 100m. Accuracy of 200. Ratio of 2 - will (just allow) entry/exit
Geo of 100m. Accuracy of 5. Ratio 1/20. Will allow with trigger entry/exit
Geo of 2000m. Acccuracy of 1000m (poor - but massive Geofence). Ratio is 1/2. So will trigger entry/exit

Closed in 0.5.4
Pending more data collection - separate log file created.