Need help! Google API Maps programming

Discussion in 'Web Design and Development' started by Chacala_Nayarit, Jun 23, 2006.

  1. Chacala_Nayarit macrumors 6502

    Chacala_Nayarit

    Joined:
    Oct 6, 2005
    Location:
    Lakewood, Washington
    #1
    I am doing this: link

    I have having a bitch of a time with the JavaScript thingy.

    What I want is to zone in on the address of the store, like on Google Maps front page.

    Anybody know how to do this?
     
  2. mnkeybsness macrumors 68030

    mnkeybsness

    Joined:
    Jun 25, 2001
    Location:
    Moneyapolis, Minnesota
    #2
    Not sure what you mean by "zone in", but if I may, I'd like to recommend a few things.

    First, set a variable for a marker to where you are pointing, not just an info window:

    Code:
    var position = new GLatLng(47.171, -122.517);
    Then, use a tabbed window for information. One tab for the address, another tab for a form to get directions from google maps:

    Code:
    var infoTabs = [
    	  new GInfoWindowTab("Address", '<h2>Rainier Lighting and Electric Supply</h2><address>ADDRESS<br />CITY, STATE ZIP</address>'),
    	  new GInfoWindowTab("Directions", '<form target="_blank" action="http://maps.google.com/maps" method="get"><fieldset><legend>Directions from Your Address</legend><input type="hidden" name="daddr" value="RAINIER SUPPLY ADDRESS" id="daddr" /><label for="saddr">Address:</label> <input type="text" name="saddr" value="" id="saddr" /><br /><input type="submit" name="submit" value="Get Directions" id="submit" /></fieldset></form>')
    ];
    
    Then, tell GMaps to draw it:

    Code:
    var marker = new GMarker(position);
    GEvent.addListener(marker, "click", function() {
     marker.openInfoWindowTabsHtml(infoTabs);
    });
    map.addOverlay(marker);
    marker.openInfoWindowTabsHtml(infoTabs);
    
     
  3. Chacala_Nayarit thread starter macrumors 6502

    Chacala_Nayarit

    Joined:
    Oct 6, 2005
    Location:
    Lakewood, Washington
    #3
    Thank you Paul! I decided to include a window with the address and "exact" GPS lacation - well, actually across the street. I added directions below the map.

    http://rainiersupply.com/map.html :cool:
     
  4. Josh macrumors 68000

    Josh

    Joined:
    Mar 4, 2004
    Location:
    State College, PA
    #4
    While the actual Google API is much more useful for custom jobs, you might want to check out GoogleMapsEZ which will help you do neat things with Google maps on your site very easily.
     

Share This Page