我有一张图片(一个圆圈),应该表示一个特定的大都市区。我也得到了我所有相关区域的 GeoPosition
。
如果我放置标记,则图像的底部中心位于标记的GeoPosition
。但是因为它是鸟瞰图,所以我想给图像一个偏移量,所以我的圆形图像的 center 在那个 GeoPosition
...
任何想法如何实现这一目标?
谢谢!
最佳答案
感谢 LeJared 我找到了解决方案。我的问题是我认为 MarkerImage
替换了 Marker
。但是您必须先定义图像,然后将其插入到 Marker
中。
示例:
首先定义图像:
var image = new google.maps.MarkerImage("some/path/image.png",
// This marker is 20 pixels wide by 32 pixels tall.
null,
// The origin for this image is 0,0.
new google.maps.Point(0,0),
// The anchor for this image is the base of the flagpole at 0,32.
new google.maps.Point(75, 35)
);
然后将其插入到常规标记中:
var myMarker = new google.maps.Marker({
position: myLatLng,
map: map,
icon: image,
title: "My Title",
});
关于android - Google Maps API - 标记图像的偏移量 - 替换标记 - 不在 GeoPosition,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12105122/