Re: Zip code



>>>I have a database of zipcodes with latitude and longitude. I also have the
>>>method of calculating the distance between two zipcodes. What I want to
>>>know is if there is an efficient algorithm for obtaining the zip codes
>>>within a specified distance of the first zipcode without having to retrieve
>>>and calculate for every record in the database.
>>
>>It depends on what you are doing, and how accurate you need to be.
>>Is that distance supposed to be DRIVING distance or distance as
>>the missile flies?
>>
>>Precomputing some of this can be used to advantage.
>>
>
>
>
>have you looked at a zip code map for Manhattan?

Assuming for the moment that you have 100 stores, and you need to
compute the distance between the 100 stores and all the Zip codes
in Manhattan, and every (9 digit) Zip code that begins with 1 is
in Manhattan (this is a ridiculous over-estimate: Westchester
county contains 10510 and the far end of New York state contains
14092 (Lewiston), and that range of zip codes certainly covers
several states), and that it takes 1 millisecond to do a distance
calculation (with a 2-3 GHz processor with a floating point unit,
this should be easy), this calculation will take about 115 days.
But you only have to do it once.

Gordon L. Burditt
.



Relevant Pages

  • Re: MySQL Query Optimization
    ... > query can take 15 seconds or more for broader searches. ... What you really need is a precomputed table of distances between zip codes. ... any location in one block is within distance of any location in the other). ... The distance table would consist of pairs of three-digit zones that meet ...
    (comp.lang.php)
  • Re: MySQL Query Optimization
    ... I need to sort the results by distance, ... Is there a simple formula to calculate in my query? ... > fortunately the US population isn't evenly distributed; some zip codes ... > Doing it that way would involve slightly less than 500K entries, ...
    (comp.lang.php)
  • Re: SQL to calculate surrounding suburbs
    ... Here is a function to calculate distance between two lat/lon ... Using this to find all codes within a given distance could ... separately for latitude and longitude - these should be the ... Also watch out for the longitude one if you are near ...
    (comp.databases.ms-sqlserver)
  • Re: SQL to calculate surrounding suburbs
    ... Here is a function to calculate distance between two lat/lon ... Using this to find all codes within a given distance could ... separately for latitude and longitude - these should be the ... Also watch out for the longitude one if you are near ...
    (comp.databases.ms-sqlserver)
  • Re: Finding the distance between 2 zip codes
    ... There is no formula for the distance between 2 zip codes. ... MsgBox "Each zip code must be 5 digits long and numeric" ... answer = Trim(Mid(resp, begAns, endAns - begAns)) ...
    (microsoft.public.office.developer.outlook.vba)