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
0
votes
1 answer
haversine distance - MySQL and PHP return different results for same formula
distance (straight)
from: (lat) 48.73233 (long) 2.36618
to: lat() 48.84647 (long) 2.41026
equals some: 13096.16 meters
If I use PHP formula, I get proper result.
But when I translate same PHP formula directly into MySQL query - I get 5904.2757…

Jeffz
- 2,075
- 5
- 36
- 51
0
votes
0 answers
Which one is better haversine or pythagorean?
I have mysql query to calculate distance between given longitudes and latitude within 50 meter radius. Here I want to know that by performance, speed and distance accuracy wise which one is better, haversine or pythagorean?

user1522804
- 149
- 2
- 11
0
votes
2 answers
Haversine formula in CakePHP 2.0 paginate fields not working
This is my first post on this site, so please be kind.
I have no trouble making this work using the find() method, but when I try to run it using the paginate component, no luck. I am simply trying to run a Haversine formula in the fields options…

daniel l
- 3
- 3
0
votes
2 answers
Using haversine formula, result too high
I have a question that I have spent too many hours trying to resolve.
I am using de Haversine formula to calculate the distance between two points, but the code that I'm using is giving me values that are too high for a distance like KM.
This is the…

Vera Rodrigues
- 83
- 1
- 10
-1
votes
1 answer
Distance Matrix Haversine
I am working on a data frame that looks like this :
lat lon
id_zone
0 40.0795 4.338600
1 45.9990 4.829600
2 45.2729 2.882000
3 45.7336 4.850478
4 45.6981 5.043200
I'm trying to make a…

firecfly
- 3
- 1
-1
votes
1 answer
Haversine Function - Python
I am trying to write a code where I am creating a haversine function to calculate the distance of a dataset containing different properties from the nearest hospital using their geolocation and this is what my code looks like:
code snippet
However,…

Maisha Kroza
- 3
- 3
-1
votes
1 answer
I have 2 dataframes with latitude and longitude in each. I want to find the 5 nearest points from df2 for each point in df1
I tried a row by row approach, like this:
library(geosphere)
best <- 1000000
for ( var1 in df1 )
{ findpoint <- c(df1$longitude[var1], df1$latitude[var1])
for ( var2 in df2 )
{ basepoint <- c(df2$longitude[var2],…

MarkBeauchene
- 37
- 4
-1
votes
1 answer
Why do I have an error when the global name has been defined?
I am attempting to use python to calculate the distance and velocity between time ordered coordinates following the steps in the answer here. Towards the end of the code, I encounter an error which says the global name has not been defined but…

Jo Harris
- 98
- 9
-1
votes
2 answers
Calculate global distance between several locations
I am working on the calculation of the distance between two global positions based on their coordinates. When using only two locations, I get results:
def global_distance(location1, location2):
lat1, lon1 = location1
lat2, lon2 = location2
…

user_01
- 447
- 3
- 9
- 16
-1
votes
2 answers
Find the final latitude longitude after a movement on the globe
I am using the Haversine formula to calculate the distance from two latitude-longitude pairs.
function getDistanceFromLatLonInKm(lat1,lon1,lat2,lon2) {
var R = 6371; // Radius of the earth in km
var dLat = deg2rad(lat2-lat1);
var dLon =…

Timothy
- 4,198
- 6
- 49
- 59
-1
votes
1 answer
get nearest latitude and longitude
I have latitude and longitude in this format :
15.1393658,76.92150059999994,13.0873783,77.41112120000003,14.7017498,77.59016529999997
If I enter the another Latitude and longitude like lat=13.0874193,lan=77.41100640000002 they has to give nearest…

Pradeep Deepu
- 25
- 1
- 3
-1
votes
1 answer
Laravel haversine calculation
I use this tool to calculate distance between 2 points:
$location = new CnpPoi(28.535153, -81.383219);
$destination = new CnpPoi(42.594018,…

rubenSousa
- 261
- 8
- 23
-1
votes
1 answer
Get distance between two different latitude and longitude in android?
I have used locationA.distanceTo(locationB);
and also have copy pasted a method written for haversine formula.
The actual distance between the two geopoints is 25m but i get a
result of 6894.52192658389 using the above methods.
Followed…

nishon.tan
- 969
- 2
- 8
- 21
-1
votes
1 answer
Calculate Distance between Current Location and Marker on Google Maps v2
I'm new here...please help me
I want to develop android application that calculate distance between user's current location and markers. It will calculate the distance when users touch the makers. I want to use Haversine Formula, but i don't know…

Lucy
- 1
- 1
- 2
-1
votes
1 answer
Query for Haversine formula in Oracle
This query is working fine but I want to use the MIN function in this query, because I want only one station which has the least distance from the given current location.
How can I use MIN in this query?
select *
from
(
SELECT…
user3954917