Reputation: 8925
I am currently writing a script to find the closest GeoPoint
(from a list of GeoPoints
located on our servers) relative to the user, however I came across and interesting idea on limiting results even further.
I am wondering if it is possible to take the Users current line-of-site, maybe using the Compass
in order to ignore GeoPoint
(s) that may or may not be closer to the user located behind them. I am not looking for this code to be written for me, just a nudge in the right direction or any suggestions, I have searched for the past couple days and am coming up empty.
When I say "line-of-site" I don't mean to specify a cone as shown below, limiting to a direction of N, S, E or W would be fine.
In the exmaple picture below I want the results to show only GeoPoint(2):
Explanation of use: The user goes to a location to take photos of several things at said location. In my Camera Activity I am writing a script to show a historic photo of one of the elements on-site relative to their location. All site-specific historic photos and their Coordinates have been retrieved and parsed using JSON.
Upvotes: 1
Views: 230
Reputation: 8533
Have a look at http://www.movable-type.co.uk/scripts/latlong.html. It gives a number of examples including how to calculate bearing and distance to a point (longitude, latitude).
Check the bearing and distance fall within your acceptable
range, whatever that may be (direction, line of sight...).
Upvotes: 1