【发布时间】:2015-09-01 10:24:36
【问题描述】:
我建立了一个坐标和其他飓风信息的数据库。
<?php
include '/database_connector.php'; //include database connection information
$new = array();
$result=mysqli_query($con, "select * from Spots15 where `Name` = 'Ana' or 'One'");
while($row=mysqli_fetch_array($result)){
$lat = $row['LAT'];
$long = $row['LONG'];
$latlong = $lat.", ". $long;
array_push($new, $latlong);
}
echo json_encode($new);
?>
这是正确的输出。这是api想要的输出
["31.5, -77.6","31.5, -77.7","31.5, -77.5","31.6, -77.8","31.5, -77.5","31.5, -77.3","31.6, -77.3","31.7, -77.4","31.9, -77.3","32.1, -77.4","32.2, -77.5","32.4, -77.6","32.6, -77.8","32.7, -77.9","32.7, -78.1","32.9, -78.3","32.9, -78.3","33.1, -78.2","33.2, -78.3","33.6, -78.5","33.8, -78.7","34.0, -78.9","34.1, -78.9","34.1, -78.9","34.4, -78.6"]
我想将这些传递给 google map api 可以在地图上绘制坐标。
var four=new google.maps.LatLng(28.2,-96.0);
【问题讨论】:
-
您是否完成了任何 Google Map API 教程?
-
是的,我知道这是坐标需要走的正确方式。我的网站上有 api。我已将热带风暴法案硬编码到首页。 hurricanetracking.us
-
您能否澄清一下..您的问题是什么以及您面临的问题是什么?
-
数组 $new 应该以以下格式输出到 javascript 中 "var four=new google.maps.LatLng(28.2,-96.0);"我想让每个变量都成为一个数字,但这可能是不可能的
标签: javascript php json google-maps-api-3