Re: Finding the distance between 2 zip codes
From: Tamir Khason (tamir-NOSPAM_at_tcon-NOSPAM.co.il)
Date: 07/20/04
- Next message: Sue Mosher [MVP-Outlook]: "Re: Redemption and XP SP2"
- Previous message: Tamir Khason: "Redemption and FreeBusy"
- In reply to: Galsaba: "Finding the distance between 2 zip codes"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 20 Jul 2004 19:13:21 +0300
There is no formula for the distance between 2 zip codes. Any system that
provides you with that information has to go to tables containing longitudes
and latitudes and compute the information.
If you want to use it for your own you can purchase this information here:
http://www.aspfaq.com/2527
alternativly, use XMLHTTP to query another Web site and return the
information. This routine is written for Office VBA, and can easily be
adapted to script:
Function getDistanceFromZipCodes()
zip1 = InputBox("Enter Zip Code 1, as xxxxx:", "Zip Code 1")
zip2 = InputBox("Enter Zip code 2, as xxxxx:", "Zip Code 2")
If Len(zip1) <> 5 Or Len(zip2) <> 5 Or Not (IsNumeric(zip1)) Or Not
(IsNumeric(zip2)) Then
MsgBox "Each zip code must be 5 digits long and numeric"
Exit Function
End If
sendStr = "http://gazetteer.hometownlocator.com/ZipDistance.cfm?Zip1=" &
zip1 & "&Zip2=" & zip2
Set xmlhttp = CreateObject("Microsoft.XMLHTTP")
xmlhttp.Open "POST", sendStr, False
xmlhttp.Send ("<dummy/>")
resp = xmlhttp.responseText
begAns = InStr(1, resp, "<strong>") + 8
endAns = InStr(1, resp, "</strong>")
answer = Trim(Mid(resp, begAns, endAns - begAns))
If answer = "5 digit" Then
MsgBox "Distance cannot be determined"
Else
MsgBox "The distance between Zip Code 1 (" & zip1 & ") and Zip Code
2 (" & zip2 & ") is " & answer & " miles"
End If
End Function
--
Tamir Khason
You want dot.NET? Just ask:
"Please, www.dotnet.us "
"Galsaba" <galsaba@aol.com> wrote in message
news:20040717165708.26080.00000027@mb-m28.aol.com...
> anyone knows what the formula is for finding a distance betweeen 2 zip
codes?
>
> Aaron
- Next message: Sue Mosher [MVP-Outlook]: "Re: Redemption and XP SP2"
- Previous message: Tamir Khason: "Redemption and FreeBusy"
- In reply to: Galsaba: "Finding the distance between 2 zip codes"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|