Page 1 of 1
Formulas
Posted: Mon May 01, 2006 5:54 pm
by s.dot
Code: Select all
SELECT
`id`,
`username`,
`mainpic`,
`user_last_visit`,
POW((69.172*(`long`-\"{$zipdata['long']}\")*cos({$zipdata['lat']}/57.3)),\"2\")+POW((69.172*(`lat`-\"{$zipdata['lat']}\")),\"2\") AS `distance`
FROM
`users`
In this query I know where 69.172 is coming from. But where is 57.3 coming from. If I pull this into an array $array['distance'] comes out as 85.3119036658 where I know it should be around 14.2 (according to google and yahoo maps)
Posted: Tue May 02, 2006 4:17 am
by GM
Hi - 57.3 is the conversion factor between radians and degrees:
1 radian = 57.3°
Who says a degree in Maths is useless?

Posted: Tue May 02, 2006 5:18 am
by Chris Corbyn
GM wrote:Hi - 57.3 is the conversion factor between radians and degrees:
1 radian = 57.3°
Who says a degree in Maths is useless?

A degree in maths is possibly one of the most useful ones to have (opinion of course). Pretty much everything comes down to Mathematics in the end. I do remember the 360 degrees = 2 * PI radians though from A-Level (16-18 yrs).
Posted: Wed May 03, 2006 1:30 am
by raghavan20
d11wtq wrote:GM wrote:Hi - 57.3 is the conversion factor between radians and degrees:
1 radian = 57.3°
Who says a degree in Maths is useless?

A degree in maths is possibly one of the most useful ones to have (opinion of course). Pretty much everything comes down to Mathematics in the end. I do remember the 360 degrees = 2 * PI radians though from A-Level (16-18 yrs).
Doing a degree in Maths will definitely improve the way one thinks. Maths and Science are the best subjects around and most of us do not realize this fact when we are younger.