[advanced search]
Results from the most recent live auction are here.
27 members in the live chat room. Join Chat!
Register Rules & FAQ NP$ Store Active Threads Mark Forums Read
Go Back   NamePros.Com > Design and Development > Programming > CODE
User Name
Password

Old 09-27-2006, 08:44 PM   · #1
Dan
Buy my domains.
 
Dan's Avatar
 
Name: Dan
Trader Rating: (63)
Join Date: Feb 2006
Posts: 2,801
NP$: 54.00 (Donate)
Dan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant future
Autism Autism Autism Autism Autism Autism Autism
Distance between longitudes and latitudes

PHP Code:
<?php

// Example points
$lat1 = '117.1216';
$lon1 = '32.69460';
$lat2 = '117.0516';
$lon2 = '32.70614';

function
deg_to_rad($deg) {
     
$radians = 0.0;
     
$radians = $deg * M_PI/180.0;
     return(
$radians);
}

$distance = 3956 * 2 * atan2(sqrt(pow(sin((deg_to_rad($lat2) - deg_to_rad($lat1))/2.0),2) + cos($lat1) * cos($lat2) * pow(sin((deg_to_rad($lon2) - deg_to_rad($lon1))/2.0),2)),sqrt(1-(pow(sin((deg_to_rad($lat2) - deg_to_rad($lat1))/2.0),2) + cos($lat1) * cos($lat2) * pow(sin((deg_to_rad($lon2) - deg_to_rad($lon1))/2.0),2))));

echo
$distance; // Miles between the points.

?>
I'm working on a script related to this and I found this pretty amazing, so I thought I'd post it.


Please register or log-in into NamePros to hide ads
Dan is offline   Reply With Quote
Old 09-27-2006, 08:48 PM   · #2
netzilla
Senior Member
 
netzilla's Avatar
 
Name: Josh Evans
Location: Ohio
Trader Rating: (34)
Join Date: Aug 2005
Posts: 1,704
NP$: 149.75 (Donate)
netzilla is a splendid one to beholdnetzilla is a splendid one to beholdnetzilla is a splendid one to beholdnetzilla is a splendid one to beholdnetzilla is a splendid one to beholdnetzilla is a splendid one to beholdnetzilla is a splendid one to beholdnetzilla is a splendid one to behold
Wow...thanks for the share.
__________________
"If PHP is peanut butter...then...MySQL would be the jelly. Together they can make one heck of a good sandwich." --- Netzilla 9/14/08
netzilla is offline   Reply With Quote
Old 09-30-2006, 04:15 AM   · #3
bbalegere
Senior Member
 
Name: Bharat Balegere
Location: Bangalore
Trader Rating: (15)
Join Date: Jul 2005
Posts: 1,178
NP$: 9.25 (Donate)
bbalegere is just really nicebbalegere is just really nicebbalegere is just really nicebbalegere is just really nice
This is basically Maths.
You just got know how Longitudes and Latitudes are calculated.
The programming part is easy.
bbalegere is offline   Reply With Quote
Old 09-30-2006, 09:54 AM   · #4
Dan
Buy my domains.
 
Dan's Avatar
 
Name: Dan
Trader Rating: (63)
Join Date: Feb 2006
Posts: 2,801
NP$: 54.00 (Donate)
Dan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant future
Autism Autism Autism Autism Autism Autism Autism
Originally Posted by bbalegere
This is basically Maths.
You just got know how Longitudes and Latitudes are calculated.
The programming part is easy.

Did anyone say anything had to be hard to be posted? I highly doubt you could figure that out anyways.
Dan is offline   Reply With Quote
Old 09-30-2006, 09:58 AM   · #5
sdsinc
Law and disorder
 
sdsinc's Avatar
 
Name: Kate
Location: Expat
Trader Rating: (57)
Join Date: Aug 2005
Posts: 5,129
NP$: 890.11 (Donate)
sdsinc has a reputation beyond reputesdsinc has a reputation beyond reputesdsinc has a reputation beyond reputesdsinc has a reputation beyond reputesdsinc has a reputation beyond reputesdsinc has a reputation beyond reputesdsinc has a reputation beyond reputesdsinc has a reputation beyond reputesdsinc has a reputation beyond reputesdsinc has a reputation beyond reputesdsinc has a reputation beyond repute
Third World Education Find Marrow Donors! Find Marrow Donors! Find Marrow Donors! Find Marrow Donors! Animal Rescue Animal Cruelty AIDS/HIV
Anybody have good sources for location databases ?
sdsinc is offline   Reply With Quote
Old 09-30-2006, 10:03 AM   · #6
Dan
Buy my domains.
 
Dan's Avatar
 
Name: Dan
Trader Rating: (63)
Join Date: Feb 2006
Posts: 2,801
NP$: 54.00 (Donate)
Dan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant future
Autism Autism Autism Autism Autism Autism Autism
Dan is offline   Reply With Quote
Old 10-01-2006, 09:14 AM   · #7
baxter
NamePros Regular
 
baxter's Avatar
 
Trader Rating: (10)
Join Date: Apr 2006
Posts: 252
NP$: 2110.00 (Donate)
baxter is a jewel in the roughbaxter is a jewel in the roughbaxter is a jewel in the rough
Ethan Allen Fund Save The Children
thanks for the share Dan.. was wondering how they figure that out.
baxter is offline   Reply With Quote
Closed Thread

NamePros is a revenue sharing forum.

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


Site Sponsors
Get Your Site Linked at LinkedKeywords.com Proof is in the Parking Proof is in the Parking
Advertise your business at NamePros
All times are GMT -7. The time now is 11:23 AM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0