Google maps and locations

Discussion in 'Programming' started by Cypherus, Aug 7, 2007.

  1. #1
    Hi there,

    I'm making a site that has a database that contains information about toons of different destinations within a few selected countries. I want to include Google maps to this site, so that when someone browses one of the destionation, the destination will also be looked up in Google maps.

    Anyone have any tips on how to do this automaticly? I've been reading myself green in the manual and on Google, but I don't seem to get it..
     
    Cypherus, Aug 7, 2007 IP
  2. tbarr60

    tbarr60 Notable Member

    Messages:
    3,455
    Likes Received:
    125
    Best Answers:
    0
    Trophy Points:
    210
    #2
    I set up Google Maps on my site last year. As I recall you need to include some Javascript and have it load the map with an onLoad command in your pages body tag. You also need to have a div tag for the area where the map will be displayed. Then you need a little more Javascript to add controls, markers, and display text.

    A simple way to get going is to visit a page, save it and edit it. All that you will need to mess with is in the body tag, div tag, and in the Javascript. Feel free to use salarymap.com as a starting point. :)
     
    tbarr60, Aug 7, 2007 IP
  3. Cypherus

    Cypherus Peon

    Messages:
    1,551
    Likes Received:
    102
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I have of course found out how to put it on my own website, and it's working pretty well. What I'm having trouble is showing the right destinations for my various sites.

    Is it possible, to have a PHP variable containing an adress, and have google maps look it up? (assuming its an valid adress, of course. All adresses will be validated by an admin before inserted into the database!) If possible, how can I do it? And of course I would love an example..
     
    Cypherus, Aug 7, 2007 IP
  4. tbarr60

    tbarr60 Notable Member

    Messages:
    3,455
    Likes Received:
    125
    Best Answers:
    0
    Trophy Points:
    210
    #4
    OK, you are further along than I thought.

    What you need is geocoding. There are a number of sites that can supply geocoding and from what I have seen Google's works best. Here's their documentation, you will see Geocoding near the top of the page:

    http://www.google.com/apis/maps/documentation/

    It works very well for the US and India, I am not sure how it will do for Europe but I expect it will do well.
     
    tbarr60, Aug 7, 2007 IP
  5. Cypherus

    Cypherus Peon

    Messages:
    1,551
    Likes Received:
    102
    Best Answers:
    0
    Trophy Points:
    0
    #5
    It works pretty damn well. This site has helped me alot in my development of my site :D
     
    Cypherus, Aug 8, 2007 IP