简体   繁体   English

Google Maps API、我的图标和默认图标都显示

[英]Google Maps API, My Icon and Default Icon Both Show Up

enter image description here在此处输入图片说明

Currently I'm using the Maps api and i've added my own icon, but for whatever reason the map shows both the default icon and my own, here is my quick code.目前我正在使用 Maps api 并且我添加了我自己的图标,但是无论出于何种原因,地图都显示了默认图标和我自己的图标,这是我的快速代码。 I'm not sure what I could be doing wrong for both icons to show up.我不确定我可能做错了什么让两个图标都显示出来。

The main issue is that the default icon shows up above whatever icon I use and it shows a weird double icon.主要问题是默认图标显示在我使用的任何图标上方,并且显示了一个奇怪的双图标。

Here is my code.这是我的代码。

var myPin = {
url: "iconfinder_Beer_Mug_drink_3017884.png",
scaledSize: new google.maps.Size(30, 30),
origin: new google.maps.Point(0, 0),
zIndex: 100
}


var marker = new google.maps.Marker({
map: map,
icon: myPin,
label: {
text: bName,
color: "#00546e",
fontSize: "18px",
fontWeight: "bold",
zIndex: 100
},
position: results[0].geometry.location
});

Any help is appreciated!任何帮助表示赞赏! Thank you!谢谢!

UPDATE : I read down the code and forgot I made a 2nd instance of the generate marker because I was planning on testing 2 different versions of it but neglected to comment one of them out.更新:我阅读了代码并忘记了我制作了生成标记的第二个实例,因为我计划测试它的 2 个不同版本,但忽略了将其中一个注释掉。 So it was always loading 2 of them.所以它总是加载其中的 2 个。

All is fixed一切都是固定的

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM