Closed Bug 515335 Opened 15 years ago Closed 15 years ago

Distance calculation between 2 geocoordinates incorrect for points not on the equator

Categories

(Core :: DOM: Geolocation, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
status1.9.2 --- beta1-fixed

People

(Reporter: mmcnicklebugs, Assigned: mmcnicklebugs)

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2
Build Identifier: 

Distance between two points is found using a naïve pythagorian calculation. The distance between degrees of longitude decreases as latitude increases and this causes an error in the above calculation. Even at modest latitudes (53°) the error can be as high as 20%.



Reproducible: Always
Attached patch PatchSplinter Review
Although the Haversine formula would be best to use, the spherical law of cosines produces nearly identical results for a simpler and cheaper calculation.
Attachment #399439 - Flags: review?(doug.turner)
Status: UNCONFIRMED → NEW
Ever confirmed: true
http://hg.mozilla.org/mozilla-central/rev/d673897fb38d
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Attachment #399439 - Flags: approval1.9.2?
Attachment #399439 - Flags: approval1.9.2? → approval1.9.2+
Assignee: nobody → mmcnicklebugs
Keywords: checkin-needed
This patch doesn't apply on 1.9.2.
Keywords: checkin-needed
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: