我正在尝试将我的自定义图标放置在坐标上的引脚底部,如下所示:
[

我知道这些和弦(在这个例子中是亚历山大)是正确的,作为测试的这里。
我像这样调用Marker构造函数:
var marker = new google.maps.Marker({
position: {lat: Number(markerData.geodata.lat), lng: Number(markerData.geodata.lng)},
title: '',
icon: {
url: _config.static.marker.default.normal.icon,
size: new google.maps.Size(3, 3, 'rem', 'rem'),
scaledSize: new google.maps.Size(3, 3, 'rem', 'rem'),
anchor: new google.maps.Point(0,0) <-- I think this is where I'm going wrong
},
type: t,
continent: markerData.continent,
country: markerData.country,
id: id,
labelTitle: markerData.name,
label: markerData.name.constructor,
labelClass: 'map-marker-label map-marker-label-village',
zIndex: 1
});发布于 2020-03-24 16:18:22
是的,你实际上发现了你犯了一个错误,锚是你图像中lat/lng坐标所在的点的坐标。
所以,如果你想要引脚底部在lat/lng坐标上,你应该在像素的图像坐标X/Y上锚定在引脚底部。
就你而言,情况将是:
anchor: new google.maps.Point(27, 54)因为你想把它放在底部的中间
https://stackoverflow.com/questions/60834844
复制相似问题