Google Maps API v3 不显示标记
我试图在谷歌地图上放置一个标记,但它没有显示。地图显示得很好,中心位于正确的位置,但后来我使用该位置作为标记 - 但它什么也没做。有什么想法吗?非常感谢!
代码如下:
if (maps.geocoder) {
maps.geocoder.geocode(
{ 'address' : mapInfo.address },
function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
mapInfo.map.setCenter(results[0].geometry.location);
var marker = new google.maps.Marker(
{
map : mapInfo.map,
posision : results[0].geometry.location,
}
)
var infowindow = new google.maps.InfoWindow({
content: "<b><u><a href='" + mapInfo.url + "'>" + mapInfo.title + "</a></u></b><br>" + mapInfo.address
});
infowindow.open(mapInfo.map,marker);
marker.setVisible(true)
console.log(marker)
}
else
{
alert("Google Maps: Адрес не найден по следующей причине: " + status);
}
}
)
}
I'm trying to place a marker on a google map, but it doesn't show up. The map shows fine and with the center at the right location, but then I use that location for the marker - and it does nothing. Any ideas? Thank you very much!
Code is as follows:
if (maps.geocoder) {
maps.geocoder.geocode(
{ 'address' : mapInfo.address },
function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
mapInfo.map.setCenter(results[0].geometry.location);
var marker = new google.maps.Marker(
{
map : mapInfo.map,
posision : results[0].geometry.location,
}
)
var infowindow = new google.maps.InfoWindow({
content: "<b><u><a href='" + mapInfo.url + "'>" + mapInfo.title + "</a></u></b><br>" + mapInfo.address
});
infowindow.open(mapInfo.map,marker);
marker.setVisible(true)
console.log(marker)
}
else
{
alert("Google Maps: Адрес не найден по следующей причине: " + status);
}
}
)
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论