我正在尝试将对象的路径绘制到googlemaps上。我在融合表上有Lat / Lon,我能够正确查询数据。但不知何故,情节正在缩减。经过几个小时的尝试,我无法弄清楚为什么没有显示任何东西。
任何人都可以指出我无法正常工作的方向。
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Fusion Tables Plot Obj</title>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load('visualization', '1');
var map;
function init() {
map = new google.maps.Map(document.getElementById('map_canvas'), {
center: new google.maps.LatLng(37.4, -122.1),
zoom: 10,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
setData();
}
function setData() {
// Create a Chart Tools query to send to Fusion Tables
var query = new google.visualization.Query(
'http://www.google.com/fusiontables/gvizdata?tq=' +
encodeURIComponent("SELECT Lat,Lon,SOG,COG FROM 1A4dzsiuWwu0oz3i50FQiicYnuxPjVKUu8lnayUQ WHERE Localtime >= '14:10:00.000' AND Localtime <= '14:13:00.000'")
);
query.send(getData);
}
// Define callback function, this is called when the results are returned
function getData(response) {
var numRows = response.getDataTable().getNumberOfRows();
for (i = 0; i < numRows; i++) {
var lat = response.getDataTable().getValue(i, 0);
var lng = response.getDataTable().getValue(i, 1);
var coordinate = new google.maps.LatLng(lat, lng);
// Get row data for the info window
var spog = response.getDataTable().getValue(i, 2);
var coog = response.getDataTable().getValue(i, 3);
createMarker(spog, coog, coordinate);
}
}
function createMarker(spog, coog, coordinate) {
// Create the marker
var marker = new google.maps.Marker({
map: map,
position: coordinate
});
}
google.setOnLoadCallback(init);
</script>
</head>
<body>
<div id="map_canvas"></div>
<script type="text/javascript" src="script/script.js"></script>
</body>
</html>