The haversine formula is an equation important in navigation, giving great-circle distances between two points on a sphere from their longitudes and latitudes.
Questions tagged [haversine]
429 questions
-1
votes
1 answer
Haversine formula in Java producing incorrect result
I am trying to use this implementation of Haversine formula given on wikipedia for trial but this formula is not giving expected result.
public class Haversine {
public static final double R = 6372.8; // In kilometers
public static double…

Shekhar
- 11,438
- 36
- 130
- 186
-1
votes
1 answer
How to create a weighted adjacency matrix in Matlab
I have a dataset in the following format:
UID Lat Long LocID
u1 lt1 lg1 l1
u1 lt2 lg2 l2
u1 lt3 lg3 l3
u2 lt4 lg4 l4
u3 lt1 lg1 l1
u3 lt4 lg4 l4
From here I need to…

Pramit
- 23
- 7
-1
votes
1 answer
MySQL query to retrieve data from table and a 2nd query to pull other results, without duplicates
I have been hunting around for a while now on this, but nothing is really coming up that does exactly what i need.
I am searching a table that contains entries with longitude and latitude values. This will return a set of results. There are also…

Nick
- 908
- 12
- 29
-2
votes
1 answer
Filter Google Maps Markers based on Distance
I am looking at filtering google maps markers based on distance from the users current location. I have this set up to bring in markers from a database and display on a map, but I want to limit the display of these markers to only show markers with…

NickSF
- 25
- 6
-2
votes
1 answer
C++ Console - New lat/lon coordinate using azimuth and range
I would like assistance understanding this code I found during a search. I have been stuck for 2 weeks trying to get it and it's holding my project back. I am honestly trying to learn as I go and not just be a script kiddie about it, but this is…

David
- 605
- 2
- 14
- 44
-2
votes
1 answer
google maps - Haversine formula with php not working
My query for haversine formula is:
$query = "SELECT id,
( 3959 * acos( cos( radians(37) ) * cos( radians( lat ) ) * cos( radians( lng ) - radians(-122) ) + sin( radians(37) ) * sin( radians( lat ) ) ) ) AS distance
FROM markers
…

user3178816
- 1
- 1
-2
votes
1 answer
Spherical Cosinus Haversine Formula
So currently i write a function haversine formula to calculate distance for 2 coordinate, and i find this code but i dont know how to write it in android. here is the function that i will created. this
private double SphericalCosinus(double lat1,…

Leonel Barcelona
- 21
- 5
-3
votes
1 answer
Find the distance between 2 coords in pandas with haversine error
I want to find the distance between 2 coords with Haversine in pandas, but it gives me the error:
The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
my df:
latitude longitude buc_lat buc_long
0 …

nnn
- 9
- 2
-3
votes
1 answer
Find time difference and distance between two Lat-Long pairs
I am trying to find the time difference ad distance between two lat long pairs.
I am getting incorrect values of time for a few records
SELECT A.ID, A.latitude, A.longitude, A.drive_time, (B.drive_time - A.drive_time) AS time_difference,…

Anmol Behl
- 3
- 1