Is there a php script around for...

Discussion in 'PHP' started by DSR, Feb 26, 2006.

  1. #1
    ... locating addresses near an address that is inputed by the user or dynamically input by a database? For example, say i have a database of restaurants, and i type in Tonys Italian restaurant in midtown manhattan. I am looking for a script that will search for address around it (from my address database) and show them as 'near by' locations.

    Does this make sense? There is probably a lot of customization to be done, but i figured if there was somethign out there that i could work off of, it's better than nothing. Thnkas! :)
     
    DSR, Feb 26, 2006 IP
  2. mad4

    mad4 Peon

    Messages:
    6,986
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Try hotscripts.

    Basically you store the locations along with their coordinates in a database. Then you select all the stores from the database and use Pythagoras to calculate the distance from each location to the location the user has entered.

    Then you load each point into an array and order the array by the distance to the users location with the shortest distance first.

    Post back if you need more help.
     
    mad4, Feb 26, 2006 IP
  3. DSR

    DSR Member

    Messages:
    77
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #3
    ah very nice! Thanks for directing me a bit :) I'll play with the various scripts and see what i can do.
     
    DSR, Feb 27, 2006 IP
  4. tccoder

    tccoder Peon

    Messages:
    69
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    There is a google maps based script out there.

    It lets you use thier script and functions to generate zip codes from address'. It also lets you generate longitude, latitudes for address' and zipcodes and calculate distance between them.
     
    tccoder, Mar 7, 2006 IP