Questions tagged [haversine]

The haversine formula is an equation important in navigation, giving great-circle distances between two points on a sphere from their longitudes and latitudes.

429 questions
0
votes
1 answer

What is the correct data type for haversine formula in mySql

When I save the longitude and latitude into the database it is stored as datatype Decimal. The longitude is saved as 34 and the latitude is saved as 118 will this work with the haversine formula. I am trying find a locations within 20 miles of the…
dscrown
  • 578
  • 1
  • 5
  • 21
0
votes
0 answers

distance between two points using haversine

I have a csv file "f1.csv" (without header): Index,Lattitude,Longitude 1,52.2296756,21.0122287 2,52.406374,16.9251681 3,52.346374,19.9251681 4,52.406374,16.9251681 I want to calculate distance for every index and append the sortest…
0
votes
1 answer

Haversine formula delivers incorrect result in Netlogo

I am using the gis extension of Netlogo and am trying to calculate distances between agents in km. With gis:envelope-of I can get agent's positions in degree (!) latitude and longitude, so I want to use the Haversine formula to calculate distances.…
derheine
  • 23
  • 3
0
votes
1 answer

Postgresql error in proximity calculation for latitude longitude

I have a table of airport data imported from here in postgresql: http://ourairports.com/data/ Here's the DDL create table flights.airports ( id integer not null constraint airports_pkey primary key, ident varchar(7) not null, type…
woodbine
  • 553
  • 6
  • 26
0
votes
0 answers

How to use Haversine formula in QueryDsl

How can I use haversine formula to filter query results in querydsl? I've got two latitude and longitude columns in my table I need to get nearest places to a specific point by latitude, longitude within a specific distance I need to use Haversine…
Omid QSM
  • 1
  • 1
0
votes
1 answer

implementing haversine distance query based on lng and lat

I have run into a problem when developing this. I have this scope function implemented that I run on the model like Listing::closest($lat, $lng)->paginate(5); public function scopeClosest($query, $lat, $lng, $distance = 0, $units = 'km') { …
niko craft
  • 2,893
  • 5
  • 38
  • 67
0
votes
1 answer

How to call data from a dataframe into Haversine function

I have a dataframe called lat_long which contains the latitude and longitude of some locations. I want to find the difference between each following location. When I use the example haversine function, i get an error. KeyError: ('1', u'occurred at…
Amy Rose
  • 95
  • 1
  • 9
0
votes
2 answers

Which one is the best for small distance like 10 meters Haversine or Law of Cosines?

I am Using Haversine Formula to find the great circle distance in my work But I want to know The most Exact formula for small distance like 10 meters only
Ramy hakam
  • 522
  • 1
  • 6
  • 19
0
votes
1 answer

How Heading is calculated

I have two positions in terms of latitude and longitude (in degrees) , I need to calculate the Heading from these two points. I am comparing my heading with a High precision GPS Receiver which gives me heading values . The algorithm I got from…
Asheesh
  • 47
  • 5
0
votes
2 answers

Haversine formula on a Firebird database

I used the following sql for mySQL but I now need to use this for a Firebird database. I have searched and read the Firebird documentation but can't seem to locate an alternative. In Firebird 'radians' and 'limit' both are not supported. Has anyone…
Jeff Ready
  • 71
  • 1
  • 8
0
votes
1 answer

Ruby Haversine Formula: Iterating Through Two Arrays

I'm having trouble iterating through two arrays using the haversine Ruby gem. I'll post the full gist here but give you an idea of what I'm trying to accomplish. https://gist.github.com/ornerymoose/c4a45540304706e78191894dfe6b2539 We have a fiber…
Nubtacular
  • 1,367
  • 2
  • 18
  • 38
0
votes
1 answer

setting up a new key value dictionary from a previous one

Sorry for the large code dump. My problem is with my last for loop. I am attempting to set up a new dictionary, "candidates," that contains all of the possible combinations of one site with another site, mapped to the distance between them. For…
Ravmcgav
  • 183
  • 1
  • 1
  • 11
0
votes
1 answer

Haversine is not giving me correct result

I am trying to calculate distance between two points in kilometers but it is giving me wrong. location.each do |loc| distance = Haversine.distance(28.6139, 77.209, loc[:lat].to_f, loc[:long].to_f).to_km puts " #{distance}" end Here…
Aniket Tiwari
  • 3,561
  • 4
  • 21
  • 61
0
votes
3 answers

Haversine based Server returns data only when coordinates are an exact match

I have a location aware server in Django that's supposed to return data only when the user is within a given radius of the database entry.. I found a code snippet in python that does just that online (here or elsewhere, I really can't remember) and…
0
votes
1 answer

Calculating heading value in a quad copter

I'm building an autonomous quad copter I'm trying to move the quad to a target GPS co-ordinate, I'm calculating the distance of the target using haversine formula, and now I want to calculate the heading. For example, I want the quad to turn to the…
hck3r
  • 189
  • 2
  • 15