2

我想从 html 图像元素而不是 URL 显示 google 标记的图像。

我怎样才能做到这一点?

以下代码未在谷歌地图上显示任何图像。带有结果 URL 的代码确实在谷歌地图上显示了图像。

var image = document.createElement('img');
            image.src = "data:image/png;base64," + base64Data;
            image.height = "40px";
            image.width = "40px";

            var icon = image; // Instead of  "../Content/images/Root.jpeg";
            var markerOptions = {
                position: bound,
                map: map,
                icon: icon 
            };

            var marker = new google.maps.Marker(markerOptions);
4

0 回答 0