Questions tagged [haversine]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
112 views

Convert WGS84 to Local Point

I have WGS84 points and I should convert to local coordinates (x, y, z) and plot in ThreeJs. I referred the below article and created a converted (refer code below) Article: Calculate distance, ...
Premkumar Jayaseelan's user avatar
1 vote
2 answers
165 views

Math error when trying to calculate the distance between two coordinates in python

I'm not sure if this is the right place but I am trying to develop a Django site that (among other things) shows public projects within 30 km of a given French commune. It mostly works fine but for ...
Ash_Crow's user avatar
1 vote
1 answer
789 views

Lat/lon after moving x meters to a specified direction

I have recently been working with coordinate systems in Python with pyproj package. I'm facing the following problem: I know my current position from a GPS receiver as EPSG:4326 latitude/longitude ...
Zni's user avatar
  • 13
0 votes
2 answers
438 views

How get distance in degrees to calculate buffers in AWS Athena?

Athena only allows to calculate the distance of the buffer in decimal degrees but this value varies with respect to the latitude in the globe, tate to obtain a distance according to the following ...
Cristián Vargas Acevedo's user avatar
2 votes
0 answers
516 views

Calculating coordinates of two GPS points whose line through them is perpendicular to two other GPS points

Given two GPS points A and B, I would like to compute the GPS coordinates A1 and A2. [A1A2] forms a segment perpendicular to segment [AB]. For this, I start to compute M1, which is the midpoint ...
Kyv's user avatar
  • 121
0 votes
1 answer
321 views

Haversine accuracy worse when using geocentric radius vs average Earth radius

I am required to calculate the distance between two points. To reduce computational complexity for an embedded system, rather than use the more accurate Vincenty that uses the WSG84 ellipsoid, I have ...
Rob's user avatar
  • 21
0 votes
0 answers
115 views

Diagonal distance of two aircraft

I want to calculate the diagonal distance of two moving aircraft to estimate relative velocity. Since the altitude and GPS position(longitude, latitude in decimal degrees WGS-84) of those two are ...
2eight's user avatar
  • 1
1 vote
1 answer
2k views

Offset Latitude and Longitude by some meters accurately - Reverse Haversine

I have a set of lat/long coordinates and need to offset the value to the "left" by < 10 meters. I calculate left by getting the direction my instrument is facing and use basic ...
user's user avatar
  • 11
2 votes
3 answers
6k views

Generate a circle of coordinates around a point, but I'm getting an Oval

I'm using the following code to attempt to generate a circle of coordinates a fixed distance (in this case 1km) around a point. I'm basing the formula on Haversine, but the output I'm seeing in Google ...
c0nt0s0's user avatar
  • 23
1 vote
2 answers
299 views

Drawing circle of a fixed radius in meter, rounding error?

I would like to provide an option to draw a circle of a fixed radius in meters. My problem is that if I enter 5 meters, I'm getting 4.99 meters if pass the LineString to sphere.getLength. My code so ...
BR75's user avatar
  • 437
0 votes
0 answers
78 views

Haversine formula on rotated poles sphere

I'm working with climate data from the CORDEX domain WAS-22. The data are on rotated poles grid defined as: char rotated_pole; :long_name = "coordinates of the rotated North Pole"; :...
ahmathelte's user avatar
1 vote
1 answer
104 views

Haversine distance versus Euclidean on an eqc "equi-distance" projection

I've got a network covering a large area, but the individual links are fairly small (<1km). For calculating edge lengths I'm trying to decide whether it would be better to use Haversine distance ...
Aaron Bramson's user avatar
7 votes
1 answer
580 views

Haversine based distance transform

I have a binary image with pixel resolution in units of degrees (EPSG:4326): In this case, all the light-blue pixels are water (value = 1) and purple pixels are not water (value = 0). I would like to ...
Jon's user avatar
  • 2,874
1 vote
1 answer
255 views

About distance between two coordinates streets?

Let's suppose there are two places coordinates (street places). I know that straight direction between them I can calculate by formula. Also we know that route between those coordinates can be ...
Alice Messis's user avatar
1 vote
0 answers
294 views

Distance difference between Pyproj and Haversine

I'm measuring the distance between two points with two different methods. This results in two very different results. Please have a look: from pyproj import Transformer from haversine import haversine,...
So S's user avatar
  • 115
1 vote
1 answer
778 views

Calculating distances with PROJ4J

I am already using proj4j in my project to convert between different coordinate reference systems. (Internally I use WGS84 but some sources supply data in a different CRS.) Now I need to calculate ...
user149408's user avatar
1 vote
1 answer
766 views

Calculate distance between consecutive GPS points for each id

I'm working with ArcMap 10.6. I have a big dataset of GPS points (so my coordinates are in latitude and longitude) with around 800 user ids. I want to calculate the distance between each GPS point, ...
Hannah's user avatar
  • 11
2 votes
1 answer
863 views

Would nearest point using Geodesic distance and nearest point using Haversine distance be the same point?

I have a point A and trying to find the nearest point to A in a list of points (B, C, D). I could use knn with haversine metrics and get the nearest point like this: knn = NearestNeighbors(...
NatalieL's user avatar
  • 123
1 vote
2 answers
1k views

When calcuating distance between points on Earth why are my Haversine vs. Geodesic calculations wildy diverging?

I am getting wildly diverging distances using two approximations to calculate distance between points on Earth's surface. I am using the Haversine (vectorized) approximation (spherical earth) and the ...
Bstampe's user avatar
  • 193
0 votes
0 answers
3k views

Difference between haversine formula & geodesic distance for calculating distance

Background I have Vehicle driving data which includes Lat/Long points of a particular route. I drive in that route for 2 times. The driving data in that route is around 20 minutes. (Approximately ...
Mari's user avatar
  • 101
2 votes
2 answers
230 views

Calculating haversine versus checking latitude and longitude digits after decimal point?

If I want to tell whether 2 points are close to each other, say at proximity of 50 meters, is it OK to compare both numbers up to a certain decimal point, for example the two points: 36.391155, -56....
pileup's user avatar
  • 121
5 votes
1 answer
2k views

What kind of margin of error can I expect in figuring distance?

I have reviewed Why is law of cosines more preferable than haversine when calculating distance between two latitude-longitude points? and that does not equate to the specific question that I wish to ...
Tango's user avatar
  • 159
-1 votes
1 answer
2k views

st_distance returns different answer than haversine formula

I have two coordinates stored as geometry in a table. They are stored in column named latlng. Now the coordinates are: 1 31.54696470032501, 74.3782182429078 2 31.548894670525055, 74.37833017871426 ...
Ehsan Bhatti's user avatar
2 votes
1 answer
744 views

Calculating relative position between geocoordinates and distances

I am working on a Unity application and am using the Haversine formula to calculate the distance between two points. I know the overall distance + the distance along the latitude and longitude are ...
mquickel's user avatar
  • 121
2 votes
1 answer
382 views

Retrieving Lat and Long positions for pixels in a neighborhood in Google Earth Engine

I need to calculate distances between two different pairs of pixels in a neighborhood. There are two solutions. The first is to reproject the image to a plane squared grid (Albers Equal Area or UTM, ...
José Lucas Safanelli's user avatar
5 votes
1 answer
706 views

Why is the length of one degree in Turf 0.9988?

Calculating the (spherical) distance along one degree of longitude at the equator in Turf returns a number less than 1 (Try it): require('@turf/turf').distance([0,0], [1, 0], { units: 'degrees' }) 0....
Steve Bennett's user avatar
0 votes
1 answer
266 views

Compute difference in lon / lat when moving at angle

I have the following problem: I have been given an origin as a lon / lat pair, a distance in kilometers and an angle on the ground, relative to the cardinal directions. My goal is to compute the ...
hfhc2's user avatar
  • 193
0 votes
1 answer
1k views

Calculate velocity x and y components from Lat,Lon and Time

I'm trying to calculate velocity components in the X and Y direction given two points: P0 = (Lat0,Lon0,Time0) and P1 = (Lat1,Lon1,Time1) The points are pretty close together so the components ...
RedM's user avatar
  • 1,423
2 votes
1 answer
1k views

How to Specify Haversine when using Buffer Method in Shapely and how to get Haversine distance between two Shapely Point objects?

I have a series of latitude/longitude pairs and I form Point() objects for each pair. I would like to form buffer regions around each point using a Haversine distance argument instead of Euclidean ...
mrphysics's user avatar
1 vote
1 answer
2k views

Vincenty's formulae to calculate in MySQL and PHP

I was reading Haversine formula on wikipedia and at the end of article its state that "More accurate methods that consider the Earth's ellipticity are given by Vincenty's formula and the other ...
androidXP's user avatar
  • 113
38 votes
3 answers
18k views

What is approximate error of Pythagorean Theorem vs. Haversine Formula in measuring distances on sphere at various scales?

Many people when first trying to calculate distances between two longitude / latitude pairs ask if Pythagorean theorem works as an appropriate distance function. Most often people answer "no, the ...
Amos Budde's user avatar
59 votes
7 answers
157k views

Calculating Latitude/Longitude X miles from point?

I am wanting to find a latitude and longitude point given a bearing, a distance, and a starting latitude and longitude. This appears to be the opposite of this question (Distance between lat/long ...
Jason Whitehorn's user avatar
46 votes
3 answers
45k views

Why is law of cosines more preferable than haversine when calculating distance between two latitude-longitude points?

In fact, when Sinnott published the haversine formula, computational precision was limited. Nowadays, JavaScript (and most modern computers & languages) use IEEE 754 64-bit floating-...
Afriza N. Arief's user avatar