Geo, Distance Radius Calculations - Please Help
Hello - PLEASE HELP ;(
I have been breaking my head over this for days. I need to do a store-level inventory analysis on a retail chain. The API allows me to query either:
SKU+ZIP+100 mile radius - returns all stores and their respective inventory level
Sku+StoreID - returns just that stores inventory level
There are about 2278 SKUs and 1473 Stores.
Right now I am using a cross-join to create API Calls:
?storeId=X&skuId=Y
which gives me 3.3 Mil API calls which is too much!
There must be a logical way to go through the store table and do some kind of calculation or grouping that eliminates all stores that are within 100 MIles of each other so that I can query the API based on the zip plus distance and that will include all stores in that radius.
For example, Los Angeles has 30 of them within a few miles, I know that I only need 1 zip code. However I also know that BumbleF#ck, Ohio has only one store so i need that zip code.
Something like:
Cluster all zipcodes that are based on their lat long within 100 miles of each other. My data shold allow that:
storeId|Zip|State|Country|Lat|Long
800460|6082|CT|US|42.00017|-72.582508|
What am I missing?