SitePoint Sponsor

User Tag List

Results 1 to 15 of 15
  1. #1
    SitePoint Enthusiast hardline's Avatar
    Join Date
    Jul 1999
    Location
    sopranoland
    Posts
    69
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I need to set up a search engine on a website to basically direct the viewer to the companies nearest distributor.
    Can i get a database or script that will not only show information based on zip code search, but will take into account that zip codes do not always represent the closest "geographical" location???? (US)(new york, not flori-duh)
    Thanks for any help,
    Hardy

  2. #2
    SitePoint Evangelist mad-onion's Avatar
    Join Date
    Aug 2000
    Location
    Land of the long white cloud
    Posts
    556
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This would not be hard, infact it would be easy, using mysql and php.

    SiteOptions >> Services :: Products :: Contact
    Developers of PHP, C++, Visual Basic, MySQL, and more!

  3. #3
    SitePoint Evangelist mad-onion's Avatar
    Join Date
    Aug 2000
    Location
    Land of the long white cloud
    Posts
    556
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This would not be hard, infact it would be easy, using mysql and php.

    I doubt that there are any turn-key scripts for this, it is quite an odd application.

    It would not cost much to get it custom scripted though. Email me if you are interested and we can arrange something, not neccesarily a monetary exchange.

    Thanks

    SiteOptions >> Services :: Products :: Contact
    Developers of PHP, C++, Visual Basic, MySQL, and more!

  4. #4
    SitePoint Enthusiast poil11's Avatar
    Join Date
    Aug 2000
    Location
    it look me along time to do that...
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    did anything ever come out of this? was it done? i have a mysql database with about 150 locations, and i want to be able for someone to just enter in there zip code and i want it to display the closest zip codes.
    Last edited by poil11; Feb 13, 2001 at 16:48.

  5. #5
    Database Jedi MattR's Avatar
    Join Date
    Jan 2001
    Location
    buried in the database shell (Washington, DC)
    Posts
    1,107
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by freddydoesphp
    if (!$this->error) {
    $sql .= "select DISTINCT zipdata.zipcode, sqrt(power(69.1*(zipdata.latitude - $lat),2)+ power(69.1*(zipdata.longitude-$long)*cos(zipdata.latitude/57.3),2)) as dist,
    locations.* from zipdata, locations WHERE " ;
    $sql .= "LEFT(locations.zip, 5) = zipdata.zipcode AND sqrt(power(69.1*(zipdata.latitude - $lat),2)+
    power(69.1*(zipdata.longitude-$long)*cos(zipdata.latitude/57.3),2)) < " . $radius ." ORDER by city, name";
    $result2 = mysql_query($sql);
    Freddy,

    That looks suspiciously like gibberish.

    Did you come up with that on your own? I hate math -- I probably would've taken the easy way out and just made a box around the point in question rather than playing with cosines and such.

  6. #6
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No I actually got the horrid math part from a script a found a while back and made it work for my situation, I am pretty good at math but not with the linear stuff.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  7. #7
    SitePoint Enthusiast hardline's Avatar
    Join Date
    Jul 1999
    Location
    sopranoland
    Posts
    69
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks for the input guys,
    i am glad this project was cancelled by the client!!!

  8. #8
    ********* wombat firepages's Avatar
    Join Date
    Jul 2000
    Location
    Perth Australia
    Posts
    1,717
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well if anyones interested , I have a complete (1999) US zip database with lat and long, etc - its about 2 meg as a text file.

    mail me if you are very bored and still want to play with it!

  9. #9
    SitePoint Enthusiast poil11's Avatar
    Join Date
    Aug 2000
    Location
    it look me along time to do that...
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i have seen this or versions of this code around, but havn't been able to figure it out how to do it. but your code was easier to understand. and i did get a text file with zipcode state, and numbers which i think are long/lat. for what i want to do, it doesn't really need to be precise, just basic. i am going to have to put all that info in to my database. i will post info if i get it working. and if i do, i will try and make it so that others can use it. whooooooooooooop.
    I will Tell you what is wrong with your website and maybe what you can do to make it better.
    Professional Web Site Reviews ... Usability ...
    Contact Me god@stillsucks.com for more information ...
    look at my other reviews, to see what i have done.

  10. #10
    SitePoint Enthusiast poil11's Avatar
    Join Date
    Aug 2000
    Location
    it look me along time to do that...
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    question:
    "06","90704","CA","AVALON",118.343706,33.331963,3445,0.000116

    06 is the state number, 90704 is the zip code, CA is the state, Avalon is the city, what are the other numbers? is 118.343706 lat and 33.331963 longitude? what are the other numbers. thanks in advance, i really want to get this working.
    I will Tell you what is wrong with your website and maybe what you can do to make it better.
    Professional Web Site Reviews ... Usability ...
    Contact Me god@stillsucks.com for more information ...
    look at my other reviews, to see what i have done.

  11. #11
    SitePoint Member
    Join Date
    Jul 2001
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Some help needed

    I am also looking for a zipcode database. I have a client that wants a zipcode search on his site to find nearest dealers within a specified distance from a zipcode. If anyone has an up-to-date database of zipcodes for the US (and a cold fusion script to search for via latitute and longitute) that will be perfect. IIf some one is selling on or knows where I can get one at a good price. Please let me know (the code is not that important... I can write that myself,... I just would like to save some time).

  12. #12
    SitePoint Addict zoordaan's Avatar
    Join Date
    Feb 2001
    Location
    NYC/Texas
    Posts
    348
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This recent thread on the php mailing list might be useful http://marc.theaimsgroup.com/?l=php-...0762511506&w=2

  13. #13
    SitePoint Member
    Join Date
    Jul 2001
    Location
    Kentucky
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    << retrospective spam removal service courtesy of the freakybot >>
    Last edited by freakysid; Sep 26, 2001 at 13:56.

  14. #14
    SitePoint Member
    Join Date
    Jul 2001
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks zoordaan, that was a BIG help. I now just need to know what the math is to figure out the distance between two zipcodes using latitude and longitude.

  15. #15
    SitePoint Addict zoordaan's Avatar
    Join Date
    Feb 2001
    Location
    NYC/Texas
    Posts
    348
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Glad that it will be useful. I have an interest in zipcodes because we were thinking of searching by zipcodes on the foodevents site, but at the time we were developing it there wasn't alot of info on doing that with php and since I was the one coding it, I didn't have the time to learn it from scratch. One of these days I'll get back to figuring it out and we may use zipcode searching yet.

    for calculations these links might help http://searchdatabase.techtarget.com...%2Fpr%2F282457

    http://aquion.hyperlink.cz/asp/nearest.html


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •