NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming > CODE
Reload this Page Distance between longitudes and latitudes

CODE This forum is for posting code snippets and example scripts that aren't quite tutorials, but could be useful for others. You may post code snippets and/or completed scripts that you've written and want to share here.

Advanced Search
7 members in live chat ~  


Closed Thread
 
LinkBack Thread Tools
Old 09-27-2006, 08:44 PM THREAD STARTER               #1 (permalink)
Dan
Buy my domains.
 
Dan's Avatar
Join Date: Feb 2006
Posts: 2,792
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 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))));
????: NamePros.com http://www.namepros.com/code/242000-distance-between-longitudes-and-latitudes.html
????: NamePros.com http://www.namepros.com/showthread.php?t=242000

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.
Dan is offline  
Old 09-27-2006, 08:48 PM   #2 (permalink)
Senior Member
 
netzilla's Avatar
Join Date: Aug 2005
Posts: 1,716
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.
netzilla is offline  
Old 09-30-2006, 04:15 AM   #3 (permalink)
Senior Member
 
bbalegere's Avatar
Join Date: Jul 2005
Location: Bangalore
Posts: 1,270
bbalegere is just really nicebbalegere 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  
Old 09-30-2006, 09:54 AM THREAD STARTER               #4 (permalink)
Dan
Buy my domains.
 
Dan's Avatar
Join Date: Feb 2006
Posts: 2,792
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  
Old 09-30-2006, 09:58 AM   #5 (permalink)
Domains my Dominion
 
sdsinc's Avatar
Join Date: Aug 2005
Location: Web 1.0
Posts: 9,955
sdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatness
 


Third World Education Find Marrow Donors! Find Marrow Donors! Find Marrow Donors! Find Marrow Donors! Animal Rescue Animal Cruelty AIDS/HIV Animal Rescue Wildlife Breast Cancer Animal Rescue Wildlife
Anybody have good sources for location databases ?
__________________
NameNewsletter.com - free lists of available domain names
ZoneFiles.net (beta) - ccTLD and gTLD droplists
sdsinc is online now  
Old 09-30-2006, 10:03 AM THREAD STARTER               #6 (permalink)
Dan
Buy my domains.
 
Dan's Avatar
Join Date: Feb 2006
Posts: 2,792
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
http://dan-friedman.com/s/zipcodes.rar
Dan is offline  
Old 10-01-2006, 09:14 AM   #7 (permalink)
NamePros Regular
 
baxter's Avatar
Join Date: Apr 2006
Posts: 360
baxter is just really nicebaxter is just really nicebaxter is just really nicebaxter is just really nice
 


Ethan Allen Fund Save The Children
thanks for the share Dan.. was wondering how they figure that out.
baxter is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


 
All times are GMT -7. The time now is 03:02 PM.

Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger