简体   繁体   English

标记阻碍了谷歌地图中的位置名称

[英]Marker obstructing the location name in google map

I have created a marker for some location but the problem is , the marker keeps obstructing the location name i want the marker to go beneath the location name without changing the current zoom level.Is there any option that can be added in the constructor我为某个位置创建了一个标记,但问题是,标记一直阻碍位置名称我希望标记位于位置名称下方而不更改当前缩放级别。是否可以在构造函数中添加任何选项

 var marker = new google.maps.Marker({
              //options
             });

Thnx谢谢

Example https://jsfiddle.net/vng1pbkf/示例https://jsfiddle.net/vng1pbkf/

One option could be to reduce the size of your marker image.一种选择是减小标记图像的大小。 sample code:示例代码:

var image = {
url: 'https://developers.google.com/maps/documentation/javascript/examples/full/images/beachflag.png',
// This marker is 20 pixels wide by 32 pixels high.
size: new google.maps.Size(20, 32),
// The origin for this image is (0, 0).
origin: new google.maps.Point(0, 0),
// The anchor for this image is the base of the flagpole at (0, 32).
anchor: new google.maps.Point(0, 32)
};

var marker = new google.maps.Marker({
  position: {lat: 25.2523934, lng: 55.3336367},
  map: map,
  icon: image
});

} }

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

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