Thanks to Cosines or Haversine formulas, I get a list of POIs ordered by there distance from where I am.
How can I get to the next level and select the POIs that correspond to the direction I'm looking at (let's say 15°+/-5°, 0=North, 90=East)?
There is not much code already. We could use an exemple like this
$gps_pos = array (
'lat'=>48.845364,
'lng'=>2.406628,
'distance'=>20);
$pois = GetPOIsFromGPS($gps_pos);
There $pois looks like
Array
(
[0] => Array
(
[id] => 336047
[gps_lat] => 48.84528500
[gps_lng] => 2.40663900
[gps_alt] => 0.0000
[distance_in_kms] => 0.0088094293255129
)
[1] => Array
(
[id] => 955092
[gps_lat] => 48.84520700
[gps_lng] => 2.40657700
[gps_alt] => 0.0000
[distance_in_kms] => 0.017828309444397
)
[2] => Array
(
[id] => 1022839
[gps_lat] => 48.84515700
[gps_lng] => 2.40644600
[gps_alt] => 0.0000
[distance_in_kms] => 0.026556875382492
)
)
The trick is now to make de GetPOIsInPOV function.
$pov = array ('hdegres' => 15, 'range'=>5);
$pois_in_pov = GetPOIsInPOV($pois, $pov);
Thanks