EAPUtilZipDistanceCalc Method |
Calculate the distance between two zip codes.
Namespace:
NetQuarry
Assembly:
EAP.Core (in EAP.Core.dll) Version: 2.0.0.0 (4.6.8.0)
Syntax public static double ZipDistanceCalc(
IDatabase db,
string zip1,
string zip2,
bool approximate
)
Public Shared Function ZipDistanceCalc (
db As IDatabase,
zip1 As String,
zip2 As String,
approximate As Boolean
) As Double
Parameters
- db
- Type: NetQuarryIDatabase
The database containing the zip code data. - zip1
- Type: SystemString
The first ZIP code. - zip2
- Type: SystemString
The second ZIP code. - approximate
- Type: SystemBoolean
If true and either or both of the specified ZIP codes are not
found, a "close" zip code will be used instead.
Return Value
Type:
DoubleThe distance between the two ZIP codes in miles, -1.0 if unable to calculate.
Remarks
The distance is the theoretical straight-line distance between the points.
It does not take altitide into account.
The distance is calculated from the lattitude and longitude associated with
the ZIP code in the xxx table in the database. These points were obtained
from the 2000 U.S. Census as downloaded from http://www.census.gov/tiger/tms/gazetteer/zips.txt.
Note that there are MANY caveats regarding this data including the fact that
not all ZIP codes are included ("the file doesn't have ZIP Codes for completely
commercial areas or for places with non-city-style addresses (most of the rural areas).")
and "coverage is not good in the rural areas" .
See Also