[英]Google map marker not in correct position
I follow this example to do this tutorial. 我按照此示例进行本教程。 Below is the link: ( https://developers.google.com/maps/documentation/javascript/examples/marker-animations-iteration ) 以下是链接:( https://developers.google.com/maps/documentation/javascript/examples/marker-animations-iteration )
I have 4 places and their latitude and longitude: 我有4个地方及其纬度和经度:
-> Westminster Bridge [51.5018457,-0.1225088] ->威斯敏斯特桥[51.5018457,-0.1225088]
-> Big Ben [51.5031154,-0.1207032] ->大笨钟[51.5031154,-0.1207032]
-> London Eye [51.503773,-0.1224413] ->伦敦眼[51.503773,-0.1224413]
-> Hungerford Bridge and Golden Jubilee Bridges [51.503773,-0.1224413] ->亨格福德桥和金禧桥[51.503773,-0.1224413]
Here is the code that I written: 这是我编写的代码:
<!DOCTYPE html>
<html>
<head>
<script src="http://maps.googleapis.com/maps/api/js"></script>
<script>
var myCenter = new google.maps.LatLng(51.508742, -0.120850);
var neighborhoods = [
new google.maps.LatLng(51.504728,-0.1216795),
new google.maps.LatLng(51.5031154,-0.1207032),
new google.maps.LatLng(51.5018457,-0.1225088),
new google.maps.LatLng(51.503773,-0.1224413)
];
var markers = [];
var map;
function initialize()
{
var mapProp =
{
center: myCenter,
zoom: 16,
mapTypeId : google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById('googleMap'), mapProp);
}
function drop()
{
clearMarkers();
for (var i = 0; i < neighborhoods.length; i++)
{
addMarkerWithTimeout(neighborhoods[i], i * 200);
}
}
function clearMarkers()
{
for (var i = 0; i < markers.length; i++)
{
markers[i].setMap(null);
}
markers = [];
}
function addMarkerWithTimeout(position, timeout)
{
window.setTimeout(function()
{
markers.push(new google.maps.Marker
({
position: position,
map: map,
animation: google.maps.Animation.DROP
}));
}, timeout);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div id="panel">
<button id="drop" onclick="drop()">Drop Markers</button>
</div>
<div id="googleMap" style="width:800px;height:600px;"></div>
</body>
</html>
Your values are wrong see the map for an example https://www.google.com/maps/place/51%C2%B030'17.0%22N+0%C2%B007'18.1%22W/@51.504728,-0.1216795,17z/data=!3m1!4b1!4m2!3m1!1s0x0:0x0 您的值有误,请参见地图示例https://www.google.com/maps/place/51%C2%B030'17.0%22N+0%C2%B007'18.1%22W/@51.504728,-0.1216795, 17z /数据=!3m1!4b1!4m2!3m1!1s0x0:0x0
I don't know what you are trying to point at but it is pointing exactly where you are asking it too. 我不知道您要指出的是什么,但这也正是您要问的地方。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.