Reputation: 127
i am developing an app which is particularly dependent upon the distance between two iOS devices. I am using GPS location of devices to calculate the distance between them. To calculate distance, i am using cllocation -distanceFromLocation method but the values generated by method is fluctuating and differs from actual distance between devices and cannot be considered even as an approximate result. For example, if the actual distance between devices is 2 to 3 meters, it gives me the result around 14 meters at some point and 43 meters at another point. Is the the function -distanceFromLocation: is not so precise and accurate????
Is there any better alternative for calculating distance using GPS latitude and longitude of devices???
Please help me out. Thanx in advance.
Upvotes: 2
Views: 459
Reputation: 77631
The accuracy of CoreLocation GPS varies greatly depending on your surroundings.
At it's most accurate it can go down to a couple of metres resolution (I'm not sure exactly) but if you're indoors it will be more like 20-50 metres.
I'm guessing that you're developing and testing the app indoors and so the fluctuations would be about normal.
Even outdoors in perfect weather CoreLocation will struggle to accurately tell you the distance between two devices over a short distance. (i.e. a couple metres).
For short range you might be better using wifi signal strength instead. Although this can also change from room to room.
Essentially, it's difficult to accurately detect the distance between two devices.
Upvotes: 1