homepage Welcome to WebmasterWorld Guest from 54.211.100.183
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / WebmasterWorld / Webmaster General
Forum Library, Charter, Moderators: phranque

Webmaster General Forum

    
longitude\latitude of each zip code\postal code
need to calculate the distance between two points
raja4

10+ Year Member



 
Msg#: 6530 posted 11:00 pm on Sep 2, 2004 (gmt 0)

We need to calculate the distance between two points for Canada and USA. Is there any free database available for Canadian Postal Codes and USA Zip codes that also provide longitude/latitude of each zip code\postal code.

Thanks
raja4

 

Birdman

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 6530 posted 11:23 pm on Sep 2, 2004 (gmt 0)

I can give you some US links:

U.S. Gazetteer: 2000 and 1990 [census.gov]
T I G E R [census.gov]

Shannon Moore

10+ Year Member



 
Msg#: 6530 posted 11:27 pm on Sep 2, 2004 (gmt 0)

There's a free one on SourceForge at
[sourceforge.net...]

I haven't used it, myself, but I will warn you I've heard it's not entirely up-to-date or thorough.

(You get what you pay for... in other words).

elklabone

10+ Year Member



 
Msg#: 6530 posted 11:52 pm on Sep 2, 2004 (gmt 0)

I used a free PHP script from Sanisoft called "Ziploc" that you can use for applications where you'd like customers to find a "store" or "dealer" near them.

... uses a database of zip codes and latitude and longitude, which is included (USA only, I believe).

Small Website Guy

10+ Year Member



 
Msg#: 6530 posted 1:28 am on Sep 3, 2004 (gmt 0)

A database of zipcodes, with the latitude and longitude of the geogrpahical center, can be purchased quite inexpensively. I think I paid $40 a year ago.

You calculate the distance using the Pythagorean Formula. Hope you remember your high school algebra clss.

mincklerstraat

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 6530 posted 8:51 am on Sep 3, 2004 (gmt 0)

Shannon: great link, I'll try that! (don't need pinpoint accuracy yet). I've also been looking for ages for one that does Belgian 'postcodes' (equivalent of zip codes), other European db's would also be nice if anyone has got any.

elklabone

10+ Year Member



 
Msg#: 6530 posted 5:37 pm on Sep 4, 2004 (gmt 0)

Actually, Small Website Guy, the Pythagorean Formula becomes inaccurate the greater the distance, because you're calculating distance across a sphere, and not a flat plane.

To be accuate, you need to use a little calculus... or someone's script.

--Mark

Small Website Guy

10+ Year Member



 
Msg#: 6530 posted 8:47 pm on Sep 4, 2004 (gmt 0)

If you account for the fact that the distance between longitude lines grows smaller, then the Pythagorean Formula will work just fine for locations in the United States.

danieljean

10+ Year Member



 
Msg#: 6530 posted 12:06 am on Sep 6, 2004 (gmt 0)

"Great Circle" distance calculation is probably more accurate.

However, most of the cheap zip code lists are inaccurate to start with, and unless you go with a very expensive solution, you won't be getting anything very accurate. Even when accurate, those are only centroids- the center most point inside a zip/postal code- customers can be quite a bit away from the center of the postal code.

Not only that, those distances are not driving distances. When I used online dating sites, they consistently messed up distance from my home because they didn't account for the harbour. I could swim there as fast as I could walk there.

All that to say... this is not incredibly accurate, so I wouldn't sweat the small stuff. It's more important to get the UI in a decent shape then fret about theoretical accuracy.

coopster

WebmasterWorld Administrator coopster us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 6530 posted 4:43 am on Sep 6, 2004 (gmt 0)

Good points, danieljean.

Regarding the calcs...

One of my first web-based trigonmetric applications was a distance calculator. I enjoyed the project tremendously and did some extensive testing on formulas.

I prefer a second version of the Haversine formula developed by Bob Chamberlain. It will give mathematically and computationally exact results, except when the two points are antipodal (on opposite sides of the Earth), then the formula is ill-conditioned, but the error, perhaps as large as 1 mile, is in the context of a distance near 12,000 miles. Bob has graciously granted use of the formula with no more than a humble request of recognition and a link to the census bureau site...

Mr. Chamberlain's discussion and the formula:
[census.gov...]

tgotchi

10+ Year Member



 
Msg#: 6530 posted 1:21 pm on Sep 6, 2004 (gmt 0)

You can free distance calculation from this website.

[zipcodeworld.com...]

You can subscribe full zip code database with latitude and longitude from [zipcodeworld.com...]

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / WebmasterWorld / Webmaster General
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved