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
0 answers
Convert Latitude longitude to meters / feet in ( haversine in python )
I already find this answer How to convert latitude or longitude to meters? and about haversine formula but it's written in javascript.
I want to know how can I give two coordinates like
48.829911, 2.373527
48.825843, 2.374273
and he will return…

winston_smith
- 57
- 7
0
votes
1 answer
Use Haversine package to compare all distances possibilities of a csv list of longitude and latitude
I have a list of lon and lat as csv file and i want to calculate the all distances, the file have arguments like this (-18.4392969, -40.2688762)
(-8.3905896, -37.4957717)
(-19.952862, -33.173232)
edit: i want to make a code that give me something…

FoE
- 1
- 2
0
votes
1 answer
PostGIS ST_Distance_Spheroid or Haversine
I used ST_Distance_Spheroid in PostgreSQL (with Postgis) to calculate the distance between Woking and Edinburgh like as follows:
CREATE TABLE pointsTable (
id serial NOT NULL,
name varchar(255) NOT NULL,
location Point NOT NULL,
…

Programster
- 12,242
- 9
- 49
- 55
0
votes
2 answers
How not to use DB in the following query having a subquery
I'm having the following function to calculate distances between two points using Haversine formula:
public static function getByDistance($distance)
{
$pubsFiltered = DB::select(
'SELECT * FROM
(SELECT *, (6371 *…

Ber Tsacianegu del Tepuy
- 361
- 1
- 4
- 18
0
votes
2 answers
pyspark - error in haversine formula
I am trying to implement a haversine_distance calculator in pyspark
I am re-using a python code that i used before for the same purpose so this is what I did:
1. Implement a function for harvesine_distance as a udf
2. In my dataframe, used it to…

E B
- 1,073
- 3
- 23
- 36
0
votes
1 answer
Calculating lowest distance point GeoJSON + Mysql + node
I want to give one point, and another one to collect points, and to order the nearest ones.
Example: There is a point about my house. I have 50,000 points in my database for supermarkets. I want to order the supermarkets closer to my house.
I…

Daniel Bastos
- 109
- 8
0
votes
4 answers
calculate distance between current coordinates and a list of coordinates
I am trying to calculate the straight line distance between coordinates. I can successfully do this using with hard coded values, however my problem comes in when I have a list of coordinates. S basically the first set of coordinates will always be…

skydev
- 1,867
- 9
- 37
- 71
0
votes
2 answers
Haversine's Formula and Python 3 - Math Domain Error
I'm trying to implement Haversine's formula to determine whether a given location's latitude and longitude is within a specified radius. I used a formula detailed here:
Calculate distance between two latitude-longitude points? (Haversine formula)
I…

Masutatsu
- 434
- 1
- 7
- 19
0
votes
1 answer
Commands out of sync error while calculating distance
I am trying to calculate distance from given Point(lat, long) but when I use an ordering by the distance column I get Commands out of sync; you can't run this command now error.
Here is my query:
SELECT id, name, country_code, postal_code, latitude,…

jsan
- 177
- 1
- 2
- 14
0
votes
0 answers
haversine formula. Total distance
I have problem with use of haversine formula in my project.
It is calculating distance from starting point to my current point ok. But when I go back to my starting point distance getting smaller.
How do I get total travelled distance? In case like…

Tom
- 27
- 2
- 7
0
votes
1 answer
how to get distance and sort by distance in angularjs?
I'm trying to get the distance between the records and the user's position. And order it by the one closest to me.
I'm using a formula similar to hacersine, but I still do not get the distance. Thanks.
My code html:

Rafael Robles
- 5
- 2
0
votes
2 answers
Get nearest point from ArrayList
i'm working on a App that has a Google map and a Polyline to specify a route. What i want is that when the user opens the map it automatically put a marker on the nearest point between the user and the polyline.
I've already set up a function that…

Diego Trujillo
- 3
- 6
0
votes
1 answer
Error locationManager.getLastKnownLocation
i follow tutorial about haversine formula
here is my function lokasi() in MainAcitvity
private void lokasi(){
location = locationManager.getLastKnownLocation(provider);
if (ActivityCompat.checkSelfPermission(this,…

Syamsul Maarif
- 3
- 6
0
votes
0 answers
Calculate distance of every other zipcode from each and every zipcode in the table column in MySQL
It may look a common question .
I am interested in finding all the zipcodes and distance from the zipcodes given in the table row and display them as one table. I tried to write procedure SQL for that but I failed . Till now I am only able to hard…

Abhishek Priyankar
- 63
- 2
- 13
0
votes
2 answers
Apply a function for every row in a dataframe for every row in another dataframe
I have two dataframes, "a" and "b". They both have gps data, but "a" has 1000 rows and "b" has 5 rows. I am comparing distances with the haversine formula, but I want to apply the function so that each row of "a" is compared to every row of "b". …

Sam
- 59
- 1
- 8