I am writing a server side java application related to Geo-fencing.
- I have a store with their latitude,longitude and radius
- I also have Person's current position(in terms of latitude & longitude).
If he arrives within the geo fence i.e., within the store's radius i have to give an alert. I googled for the solution & there are some methods to identify person is inside the fence(circle) or outside the fence.
- Calculate distance between store latitude,longitude and person's current latitude & longitude and if
Distance < radius
then person is inside the fence else outside the fence. - Using Polygon Geofencing
Can anyone suggest me which method is best from the above.
Thanks in advance