Google maps 谷歌地图API v3-未定义GIcon
我知道从v2到v3都存在一些问题,我可以在这里做些什么来解决这些问题?Google maps 谷歌地图API v3-未定义GIcon,google-maps,google-maps-api-3,google-api,google-maps-markers,google-maps-api-2,Google Maps,Google Maps Api 3,Google Api,Google Maps Markers,Google Maps Api 2,我知道从v2到v3都存在一些问题,我可以在这里做些什么来解决这些问题? v3不支持GIcon // Google-Map icon object var gMapIcon = new GIcon(G_DEFAULT_ICON); //change to new google.maps.MarkerImage();??? // does icon exist if ( mapElements[lMapElementIndex]['icon'].toString().length > 0) {
v3不支持GIcon
// Google-Map icon object
var gMapIcon = new GIcon(G_DEFAULT_ICON); //change to new google.maps.MarkerImage();???
// does icon exist
if ( mapElements[lMapElementIndex]['icon'].toString().length > 0) {
gMapIcon.image = html_entity_decode(mapElements[lMapElementIndex]['icon']);
gMapIcon.shadow = "";
iconHeight = mapElements[lMapElementIndex]['iconheight'];
iconWidth = mapElements[lMapElementIndex]['iconwidth'];
gMapIcon.iconSize = new GSize(iconWidth,iconHeight);
gMapIcon.iconAnchor = new GPoint(0,0);
gMapIcon.infoWindowAnchor = new GPoint(15,10);
}
var markerOptions = {
icon: gMapIcon //change to image?
};
var marker = new google.maps.Marker(point,markerOptions);
从这里找到的
谢谢你的帮助和提示
GIcon
不受版本3支持,并且不会出现在您链接到的文档中
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
});
您可以直接指定要使用的图像,而不需要像版本2的GIcon
这样的辅助对象。但是,如果需要非标准尺寸等,则需要使用MarkerImage
对象,如中的文档所述
(版本2的GIconGIcon
与版本3中可选的MarkerImage
具有同等功能)