Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Calculating geospatial distance with radians

I have a method in an API that takes a lat/long coordinate and will find other coordinates within a specified distance. That distance is in radians.

All the math I do these days deals with accounting or maybe x,y coordinates for laying out UI elements, so I appreciate some help validating these numbers.

Lets ignore people in buildings (altitude) and the fact that the planet isn't perfectly spherical. It is my understanding that the supplied method is doing the Haversine formula internally but that detail is isolated from me.

I am looking at the formula for radians:

θ = s /r, where θ is the subtended angle in radians, s is arc length, and r is radius

Given the convenient mean radius of the Earth of:

6371 km (≈3,959 mi)

I have seen other places saying (6378km)

That means 1 radian on Earth is equal to 6371 km in arc length. That would mean the radian for finding coordinates 1 meter apart would be

( 1 / 6371 ) × 10-7
ie - 1.56961231 × 10-7.

Is that right? If not where is the above incorrect?

like image 783
blu Avatar asked Oct 29 '10 17:10

blu


1 Answers

It's correct. Although I feel a little shame posting this as an answer :)

like image 91
Dr. belisarius Avatar answered Oct 07 '22 02:10

Dr. belisarius