WEB google maps API

Discussion in 'OT Technology' started by JEWbacca, Sep 9, 2009.

  1. JEWbacca

    JEWbacca =/

    Joined:
    May 10, 2001
    Messages:
    2,230
    Likes Received:
    0
    Location:
    Long Beach, CA
    i'm using the google maps api and I was wondering if there is a way to provide a link which would recenter the map to how it was originally displayed?

    the view of the map shifts when people click on various markers, and this leaves some of the other markers out of view.

    essentially all I want is a javascript targeted link which would do this, is there a standard method anyone is aware of?

    thanks in advance.
     
  2. fishbulb

    fishbulb Active Member

    Joined:
    Oct 29, 2001
    Messages:
    6,848
    Likes Received:
    4
    Location:
    md
  3. JEWbacca

    JEWbacca =/

    Joined:
    May 10, 2001
    Messages:
    2,230
    Likes Received:
    0
    Location:
    Long Beach, CA
    fishbulb / Josh - thanks, I just figured out how to take advantage of the load() function.

    Another question... I want to use two different icon types, one with and one without shadows.

    Here are the properties for for the icons w/ shadow:

    Code:
    var cm_baseIcon = new GIcon();
    cm_baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
    cm_baseIcon.iconSize = new GSize(20, 34);
    cm_baseIcon.shadowSize = new GSize(37, 34);
    cm_baseIcon.iconAnchor = new GPoint(9, 34);
    cm_baseIcon.infoWindowAnchor = new GPoint(9, 2);
    cm_baseIcon.infoShadowAnchor = new GPoint(18, 25);
    The icons are later called out using:

    Code:
    var nIcon = new GIcon(cm_baseIcon);
      if(rank > 0 && rank < 15) {
        nIcon.imageOut = "http://gmaps-samples.googlecode.com/svn/trunk/" +
            "markers/" + param_iconType + "/marker" + rank + ".png";
        nIcon.imageOver = "http://gmaps-samples.googlecode.com/svn/trunk/" +
            "markers/" + param_iconOverType + "/marker" + rank + ".png";
        nIcon.image = nIcon.imageOut; 
    	 } else {
         nIcon.imageOut = "http://gmaps-samples.googlecode.com/svn/trunk/" +
            "markers/" + param_iconType + "/marker" + rank + ".png";
        nIcon.imageOver = "http://gmaps-samples.googlecode.com/svn/trunk/" +
            "markers/" + param_iconOverType + "/marker" + rank + ".png";
        nIcon.image = nIcon.imageOut; 
      } 
    
    I thought I could do something like this:

    Code:
    var cm_baseIcon = new GIcon();
    cm_baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
    cm_baseIcon.iconSize = new GSize(20, 34);
    cm_baseIcon.shadowSize = new GSize(37, 34);
    cm_baseIcon.iconAnchor = new GPoint(9, 34);
    cm_baseIcon.infoWindowAnchor = new GPoint(9, 2);
    cm_baseIcon.infoShadowAnchor = new GPoint(18, 25);
    var cm_baseIcon2 = new GIcon2();
    cm_baseIcon2.shadow = "";  // NO SHADOW FILE 
    cm_baseIcon2.iconSize = new GSize2(20, 34);
    cm_baseIcon2.shadowSize = new GSize2(0, 0); // NO SHADOW DIMENSIONS 
    cm_baseIcon2.iconAnchor = new GPoint2(9, 34);
    cm_baseIcon2.infoWindowAnchor = new GPoint2(9, 2);
    cm_baseIcon2.infoShadowAnchor = new GPoint2(0, 0); // NO SHADOW ANCHOR INFO 
    
    and

    Code:
    var nIcon = new GIcon(cm_baseIcon);
    var nIcon2 = new GIcon2(cm_baseIcon2);
      if(rank > 0 && rank < 15) {
        nIcon.imageOut = "http://gmaps-samples.googlecode.com/svn/trunk/" +
            "markers/" + param_iconType + "/marker" + rank + ".png";
        nIcon.imageOver = "http://gmaps-samples.googlecode.com/svn/trunk/" +
            "markers/" + param_iconOverType + "/marker" + rank + ".png";
        nIcon.image = nIcon.imageOut; var nIcon = new GIcon(cm_baseIcon);
    	 } else {
         nIcon2.imageOut = "http://gmaps-samples.googlecode.com/svn/trunk/" +
            "markers/" + param_iconType + "/marker" + rank + ".png";
        nIcon2.imageOver = "http://gmaps-samples.googlecode.com/svn/trunk/" +
            "markers/" + param_iconOverType + "/marker" + rank + ".png";
        nIcon2.image = nIcon2.imageOut; 
      } 
    
    .... but it does not seem to work. Any suggestions?
     

Share This Page