Google Maps API v3 - GIcon is not defined

☆樱花仙子☆ 提交于 2019-12-04 02:22:37

GIcon is not supported by Version 3, and does not appear in the documentation you link to.

  var image = 'beachflag.png';
  var myLatLng = new google.maps.LatLng(-33.890542, 151.274856);
  var beachMarker = new google.maps.Marker({
      position: myLatLng,
      map: map,
      icon: image
  });

You can specify an image to use directly, you don't need a helper object like Version 2's GIcon. However, if you want non-standard sizes etc you will need to use a MarkerImage object as described in the documentation at https://developers.google.com/maps/documentation/javascript/overlays?hl=de-DE#ComplexIcons

(Version 2's GIcon has its equivalent as the optional MarkerImage in Version 3)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!