Thanks for the info. I will need to learn what a centroid is. Right now we
do a straight line, as a crow flies to calculate distance to the nearest
dealer.

Also, thanks to the other George and Paul. Rmagellan is good for adhoc but I
need a table of every zip code mapped to a dealer based on the closest
dealer. This is for US and Canada.

ZipCode DealerNumber
------- ------------
12345                   001
12346                   001
12347                   002


Dan Goldberg 

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Javier
Valencia
Sent: Tuesday, August 11, 2009 1:23 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - RE: SOT: zip codes

Dan,

This is a piece of cake if you have GIS available. In your case, you can
download files with the centroid for each zip code from sites, such as this:

http://www.census.gov/geo/www/tiger/zip1999.zip

It comes as a Word Document and a DBF database. I believe the Post Office
also has files you can download at no cost.

You can simplify the calculation dramatically if you ignore earth's
curvature and assume a straight line between centroids. Since you are not
looking at large distances the difference should not be too bad. I am sure
that you can download freeware calculators that would do the calculations
including all factors.

One item that you need to consider is whether you want a straight line
distance or a driving distance; the difference between these two approaches
could be large.

You can also create an expression and pass it on to Google (if Internet is
available) and let Google (or any mapping service) do the work for you.

Javier,

Javier Valencia
913-915-3137

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Dan Goldberg
Sent: Tuesday, August 11, 2009 1:06 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - SOT: zip codes

I am investigating on how to find the nearest zip code from another zip code
based on distance. I am working on a dealer locator solution.

I was wondering if anybody else has done this in Rbase. I am thinking there
is an additional data field needed to determine the physical location(maybe
latitude and longitude??). I am not sure.

I know there are hosted solutions but I am looking for an in house solution
to save some $$$.

TIA

Dan Goldberg


Reply via email to