使用地图可视化data format,我似乎无法从地址字符串中获取地图。
地理坐标与示例中提供的地理坐标完全相同,但地址不会产生渲染地图。
Here是功能性地理坐标图和非功能性地址图的示例。根据文档,地址DataTable和Map声明看似有效,但导致了一个神秘的控制台错误:“Uncaught InvalidValueError:unknown property kS”。
google.load("visualization", "1", { packages: [ "map" ] });
google.setOnLoadCallback(drawMaps);
function drawMaps()
{
var geoDataTable = google.visualization.arrayToDataTable(
[
[ "Latitude", "Longitude" ],
[ 40.748298, -73.985541 ]
]);
var geoMap = new google.visualization.Map(document.getElementById("geoMap"));
geoMap.draw(geoDataTable, { showTip: true });
var addressDataTable = google.visualization.arrayToDataTable(
[
[ "Address" ],
[ "350 5th Ave, New York, NY" ]
]);
var addressMap = new google.visualization.Map(document.getElementById("addressMap"));
addressMap.draw(addressDataTable, { showTip: true });
}