[thelist] Best Practices for building a zip/postal code based dealer locator
.jeff
jeff at members.evolt.org
Wed Sep 26 21:07:21 CDT 2001
bryce,
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> At 04:50 PM 9/26/2001, you wrote:
>
> I have been tasked with coming up with posible
> solutions for building a dealer locator that is
> to be searched by postal code.
>
> Can anyone who has built something like this share your
> experience on the best practices on how to go about
> building this and pitfalls to watch out for would also
> be greatly appreciated. If anyone has any boxed
> solutions they can recommend that would also be great.
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
i'll start off by showing you the one i rebuilt recently.
http://www.burley.com/html/locator/index.html
this locator uses latitude/longitude to determine proximity. for
simplicity purposes it actually measures it based on a square with sides a
selected distance from the center point, rather than a radius. for the
most accurate results you'd want to do the extra math to do it based on an
actual radius. however, if you're searching for proximity in the range of
mile-plus and not actual distance, the square method is close enough.
the misleading part is that the latitude/longitude are the physical
location of the post office serving the zip code selected. this isn't
likely to be the center of the zip code area, won't indicate the size of
the area the zip code covers, and won't reflect the shape of the area the
zip code covers. this is important to consider if your audience for this
locator aren't likely to know the region they're looking in -- perhaps a
motel location or atm location search. it's not so much of an issue if
they're likely to know the area very well.
all that aside, the important thing to make sure to do when building a
latitude/longitude-based solution is to make sure your search engine is
always using up-to-date information. you'd be surprised how often zip
codes, latitude/longitude, and other factors change. on average there are
about 2 dozen changes each month. the solution is to outsource this
information gathering/management to someone else. for us-based zip
searches, we use jay's computer services (http://www.jcsm.com/) for our
data. it comes to us in a multitude of formats and is reasonably priced at
about $250/usd per year. according to their site they also do canadian
postal codes as well. if you need to do this for other parts of the world,
you're on your own.
with latitude/longitude information it's fairly easy to find other zip
codes within a given range. then, take that list of zip codes and search
against the zip codes of your dealers adding any additional criteria like
product they carry, product in-stock, etc. and display that to the user.
one word of caution -- doing a wildcard search using the first 3 or 4
digits of a zip code is *nowhere* near accurate or relevant. zip codes are
not handed out in any sort of logical manner. you won't have 97116 next to
97115 or 97117. neither will 97116 be as close to 97100 or 97199 as you
might hope. here's an example using the zips noted. all miles are
point-to-point and do not reflect the actual driving mileage between points.
97116 - forest grove, oregon
97117 - gales creek, oregon
6.77 miles from 97116
5.66 miles south of 97116
3.73 miles east of 97116
97115 - dundee, oregon
31.94 miles from 97116
27.91 miles south of 97116
15.60 miles east of 97116
97101 - amity, oregon (97100 doesn't exist)
40.39 miles from 97116
39.99 miles south of 97116
5.72 miles east of 97116
97149 - neskowin, oregon (this is the highest 971 goes)
46.97 miles from 97116
39.27 miles south of 97116
25.90 miles west of 97116
and a couple more to show the problem it creates:
97114 - dayton, oregon
36.05 miles from 97116
33.70 miles south of 97116
12.88 miles east of 97116
97118 - garibaldi, oregon
27.74 miles from 97116
6.58 miles south of 97116
26.97 miles west of 97116
97113 - cornelius, oregon
14.66 miles from 97116
4.00 miles south of 97116
14.11 miles east of 97116
97119 - gaston, oregon
13.92 miles from 97116
13.50 miles south of 97116
3.41 miles east of 97116
97112 - cloverdale, oregon
40.06 miles from 97116
29.30 miles south of 97116
27.42 miles west of 97116
97121 - hammond, oregon (97120 doesn't exist)
47.96 miles from 97116
36.95 miles north of 97116
30.44 miles west of 97116
97111 - carlton, oregon
27.04 miles from 97116
26.04 miles south of 97116
7.31 miles east of 97116
97110 - cannon beach, oregon
33.72 miles from 97116
15.48 miles north of 97116
29.90 miles west of 97116
97140 - sherwood, oregon
31.82 miles from 97116
21.99 miles south of 97116
23.06 miles east of 97116
97146 - warrenton, oregon
42.40 miles from 97116
31.90 miles north of 97116
27.81 miles west of 97116
these are relatively close in numeric sequence, but in exact opposite
directions from 97116.
the odd thing is that 97062 (tualatin, oregon) and is right next to 97140
(sherwood, oregon). it's only 34.78 miles away from 97116 (forest grove,
oregon) or 5.12 miles from 97140 (sherwood, oregon). actually, that's how
far apart the post offices are. in reality, the edges of the two towns are
right next to each other -- leave one as you're entering the other kind of
thing. you have a dealer located on the south-east side of sherwood and
another on the north-west side of tualatin and they could only a few miles
apart. however, 97062 won't be returned in a '971%' wildcard search in
favor of zip codes that are as much as half-again as far from 97116 as
97062. this inaccuracy is heightened by broadening the search to only
include the first two digits of the zip code. what do you do for zip codes
that currently have alot of holes in the sequences? finally, using a
wildcard search it is impossible to give the user an idea of the distance
from the originating point, even only as an approximation.
good luck,
.jeff
http://evolt.org/
jeff at members.evolt.org
http://members.evolt.org/jeff/
More information about the thelist
mailing list