|
Posted by Gordon Burditt on 07/29/05 07:02
>>>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
[Back to original message]
|