Forum Moderators: phranque
A user would type in their zip code and the output would be the closest 2 or 3 stores to that zip code as well as the distance of each store to the zip code entered.
Do you guys know of any plug-ins out there that do that already? I don't want to re-invent the wheel.
Well, actually there is plenty worse but still it is irritating when listing are out of date.
I'm only actually dealing with 13 stores, so I can probably maintain a flat file database. My concern is just creating the script to determine which is the closest store (and how much of a distance away) from the inputed zip code.
Lists of latitude and longitude for all the zip codes (centroids in GIS parlance) can be a bit pricey, and most tend to be inaccurate. If you have only 13 stores, though, that will be "accurate enough."
I found an sql query for getting the list of stores by distance. There are a few around and they basically boil down to this:
Select name,
(69.09*DEGREES(ACOS(SIN(RADIANS($latitude))
*SIN(RADIANS(44.66256))+COS(RADIANS($latitude))
*COS(RADIANS(44.66256))*COS(RADIANS($longitude-63.59855)))))
AS distance
FROM store
Ideally, a store locator application would be offered as a web service for about the same price you pay for data alone today. Have fun! :)
I'm going to teach myself PHP and MYSQL as I'm running into some problems with PERL database handling.
Any good tutorials out there?
Espcially in regards to database handling with PHP.
[yourphppro.com...]
I've never used it so no comments to offer.