Forum Moderators: phranque

Message Too Old, No Replies

Zip Code Search

         

geoapa

3:16 pm on Jun 3, 2004 (gmt 0)

10+ Year Member



I'm looking to build a store locator script.

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.

ControlEngineer

5:49 pm on Jun 3, 2004 (gmt 0)

10+ Year Member



You might check with Yahoo to see if they provide a plugin. Their maps provide for the listing of stores. I don't know if they provide plugins for websites or not.

It would have to be a service that has a data base of stores, by location (unless you already have one).

paisore

6:56 pm on Jun 3, 2004 (gmt 0)

10+ Year Member



I had to modify a script for a client that did exaclty that. It is called bullseye pro, last time I checked (about 2 years ago) they had an asp, .net and dll version...

ControlEngineer

11:49 pm on Jun 3, 2004 (gmt 0)

10+ Year Member



What keeps the database of store locations and names updated? I would think that is the hard part and the data base would have to be supplied by a large organization. There is nothing worse than finding a store near you and then finding that the store closed a year ago (like the day after that year's yellow pages were printed).

Well, actually there is plenty worse but still it is irritating when listing are out of date.

wavebird23

12:35 am on Jun 4, 2004 (gmt 0)

10+ Year Member



Search hotscripts for some of the scripts that you are looking for.

geoapa

3:37 pm on Jun 4, 2004 (gmt 0)

10+ Year Member



Hey thanks for all your feedback, I'll check out some of the things you guys suggested.

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.

danieljean

4:45 pm on Jun 4, 2004 (gmt 0)

10+ Year Member



geoapa, I've just finished something similar in Java/MySQL; it's pretty trivial.

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

Note I don't understand the trigonometry, but I found this same formula in a couple different places and it seems to work accurately.

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! :)

geoapa

7:08 pm on Jun 17, 2004 (gmt 0)

10+ Year Member



Wow, this is turning out to be more involved than I thought!
I've purchased a zip code database (with longitude/latitude info). Now I'm trying to code it.

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.

achaeus

6:55 am on Jun 20, 2004 (gmt 0)

10+ Year Member



Might want to check this out if you're looking for something ready.

[yourphppro.com...]

I've never used it so no comments to offer.