javascript 更改谷歌地图中的标记大小

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18264033/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-27 11:16:14  来源:igfitidea点击:

Changing Marker Size in google maps

javascriptgoogle-mapsgoogle-maps-api-3

提问by MasterWizard

I'm trying to change the marker size, and no matter how I try they just disappear. I've tried this:

我正在尝试更改标记大小,无论我如何尝试它们都会消失。我试过这个:

scaledSize: new google.maps.Size(100, 68)

scaledSize: new google.maps.Size(100, 68)

var marker;
addressDetails = stringArray[x].split("&&&");
var lat = new google.maps.LatLng(addressDetails[1], addressDetails[2]);
//Create a new marker and info window
marker = new google.maps.Marker({
    map: map,
    position: lat,
    icon: 'http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=A|000000|FFF',
    content: addressDetails[0]
});
markersArray.push(marker);

回答by Zone6

Use https://developers.google.com/maps/documentation/javascript/overlays#Markersfor future reference

使用https://developers.google.com/maps/documentation/javascript/overlays#Markers以供将来参考

new google.maps.Size(42,68)

42 and 86 are pixel values. Those will scale the marker to whatever you want.

42和86是像素值。这些会将标记缩放到您想要的任何内容。

Source: Change marker size in Google maps V3

来源: 在谷歌地图 V3 中更改标记大小