Calculate distances between markers and sort them (longitude, latitude) by your 'GPS position'

408
Vote up!

Do you want to calculate the distances between different GPS markers?
Do you want to sort the markers by distance?
Then this is what you're looking for!

Features:
- Sort GPS markers by distance, based on a custom/current GPS location
- Get distances in meters, based on the custom/current GPS location
- Output array in console (print_r)

Checkout my Github GIST to find the code.

Example output:
OUTPUT:
[1] => table: 002ABBC0 {
[longitude] => 40.644178
[latitude] => -73.949204
[title] => Brooklyn
[distance] => 5662.823745369
}
[2] => table: 002ABBC0 {
[longitude] => 39.918163
[latitude] => -75.181275
[title] => South Philadelphia West
[distance] => 133824.02894993
}
[3] => table: 002ABBC0 {
[longitude] => 45.367584
[latitude] => -62.937013
[title] => Nova Scotia
[distance] => 1242546.4018208
}

Category: 
Contributor: 
Foxbyte