A possible problem with tachyon's code is that it doesn't work unless you happen to be in a zip code with distributors

If you call call the UPSPS National Customer Support Center at (800) 238-3150 you can talk to the them about ordering zip/latitude/longitude data

The documentation for this data is available as a pdf on the usps site.

It seems like most people find a vendor to give them this data.The USPS FAQ talks about it a bit.

I'm guessing that the 'ol a**2 + b**2 =c**2 would be how you would compute the shortest distance between two arbitrary zip codes. No doubt the monk map uses nicer code...

use strict; use warnings; my $x1=10; my $y1=20; my $x2=-8; my $y2=2; my $dist=sqrt(($x1-$x2)**2+($y1-$y2)**2); print "$dist =distance";
Of course you have to (pre?) compute the distance between the user's zip code and many of the other zip codes in your database...



--mandog


In reply to Re: Zipcode search engine by mandog
in thread Zipcode search engine by Jerry

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.