Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Distance in earth's surface - after reviewing osDate!

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Tips and Tricks
View previous topic :: View next topic  
Author Message
bimal
Smarty Elite


Joined: 19 Apr 2007
Posts: 423

PostPosted: Wed Sep 02, 2009 4:42 pm    Post subject: Distance in earth's surface - after reviewing osDate! Reply with quote

osDate is a dating and match making script. It uses Smarty, and is easy to customize. You can download the software from: ( http://www.tufat.com/s_free_dating_system.htm ). The total size is 36.6 MB (.tgz format). This article does not really site anything for Smarty, but the users may take an interest in this. I found it everything in osDate, a tool that uses Smarty.

Here, I am describing a little on how to calculate the distance on the surface of the earth. Go back to schooling (trigonometry, to find out an outer surface on a circular object – the earth).

Match making scripts may need to know the distance between two member’s locations. osDate uses the longitude and latitude of the two points on the earth’s surfaces, and uses some standard calculations for finding out the distance.

However, the calculated distance is not so accurate for many reasons. First, it tries to find out the straight distance only (real distance may need to consider the road ways which can not me straight most of the times).

Just, download the application and read out the codes written in its cron files. Everything will be self clear.


Last edited by bimal on Wed Sep 02, 2009 5:19 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
bimal
Smarty Elite


Joined: 19 Apr 2007
Posts: 423

PostPosted: Wed Sep 02, 2009 5:18 pm    Post subject: the formula and useful links Reply with quote

The file you must see is: cronjobs/mymatches_email.php

Here are the calculations:

In kilometers:
(sqrt(power(69.1*(user.zip_latitude - $lat),2)+power(69.1*(user.zip_longitude-$lng)*cos(user.zip_latitude/57.3),2))

In Miles:
( (3958* 3.1415926 * sqrt((user.zip_latitude - $lat) * (user.zip_latitude- $lat) + cos(user.zip_latitude / 57.29578) * cos($lat/57.29578)*(user.zip_longitude - $lng) * (user.zip_longitude - $lng))/180)

Please see these urls as well:
http://www.movable-type.co.uk/scripts/latlong.html
http://www.meridianworlddata.com/Distance-Calculation.asp
http://www.ncgia.ucsb.edu/giscc/units/u014/u014.html
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Tips and Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP