我使用 gmaps.js 示例和文档尝试在谷歌地图上绘制路径,但它不绘制任何东西。
我的代码在这里:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Show Vehicles</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="http://maps.google.com/maps/api/js?sensor=true"></script>
<script src="js/gmaps.js"></script>
<script type="text/javascript">
var map;
$(document).ready(function(){
map = new GMaps({
div: '#map',
lat: 53.361320,
lng: -6.505633,
click: function(e){
console.log(e);
}
});
path = [[53.361320,-6.505633],[53.361330,-6.505643],[53.361335,-6.505650],[53.361343,-6.505652],[53.361352,-6.505668],[53.361347,-6.505672],[53.361342,-6.505688],[53.361347,-6.505700],[53.361337,-6.505717],[53.361352,-6.505722],[53.361342,-6.505735],[53.361357,-6.505740],[53.361372,-6.505753],[53.361383,-6.505758]];
map.drawPolyline({
path: path,
strokeColor: '#131540',
strokeOpacity: 0.6,
strokeWeight: 6
});
});
</script>
</head>
<body>
<div id="map"></div>
</body>
</html>
请帮我