Marker off-set on Google Map API v3

后端 未结 4 1967
忘掉有多难
忘掉有多难 2021-01-01 20:54

I\'ve created a simple map with custom PNG markers. Is it possible to offset the attached PNG image? There does not seem to be any mention of an \'offset\' in the Google Ma

4条回答
  •  粉色の甜心
    2021-01-01 21:35

    I was looking for just this option and found a sample here:
    http://econym.org.uk/gmap/custom.htm

    Setting iconAnchor (on the marker data actually) worked for me.

       var Icon = new GIcon();
          Icon.image = "mymarker.png";
          Icon.iconSize = new GSize(20, 34);
          Icon.shadow = "myshadow.png";
          Icon.shadowSize = new GSize(36, 34);
          Icon.iconAnchor = new GPoint(5, 34);
          Icon.infoWindowAnchor = new GPoint(5, 2);
          Icon.transparent = "mytran.png";
    

提交回复
热议问题