我在我的項目中使用GoogleMap API,通過使用數據庫中的數據渲染特定車輛的位置,我已經實現了這一點,我的問題是如果它有可能在標記上得到數字,一直在1 100個地方Decembre 2,我想有開始從1到100的數字還挺顯示出它的路徑,這是創造我的谷歌API的標記功能:如何將數字放在Google Map API標記上?
function createMarker(point, IMEI, Velocity, Ora, Data) {
var marker = new GMarker(point, iconBlue);
var html = "<b>" + "Ora: " + "</b>" + Ora + "<br/>" + "<b>" + "Data: " + "</b>"+ Data + "<br/>" + "<b>" + "Velocità: " + "</b>" + Velocity + " km/h" ;
GEvent.addListener(marker, 'click', function() {
marker.openInfoWindowHtml(html); });
return marker;
}
這是他們所使用的代碼輸出被googmapsapi.html使用,輸出是一個簡單的xml文件,其中包含許多「標記」標記,包含諸如long,lat,日期和時間等信息,可以使用該列表以某種方式獲取數字嗎?
// Opens a connection to a MySQL server
$connection=mysql_connect ("localhost","root","alphabravo");
if (!$connection) {
die('Not connected : ' . mysql_error());
}
// Set the active MySQL database
$db_selected = mysql_select_db("tracciasat", $connection);
if (!$db_selected) {
die ('Can\'t use db : ' . mysql_error());
}
// Select all the rows in the markers table
//$query = "SELECT * FROM sessione WHERE 1";
$query = "SELECT * FROM sessione WHERE Dat BETWEEN '$_GET[strt]' AND '$_GET[end]' AND IMEI = '$_GET[id]'";
$result = mysql_query($query);
if (!$result) {
die('Invalid query: ' . mysql_error());
}
header("Content-type: text/xml");
// Start XML file, echo parent node
echo '<markers>';
// Iterate through the rows, printing XML nodes for each
while ($row = @mysql_fetch_assoc($result)){
// ADD TO XML DOCUMENT NODE
echo '<marker ';
echo 'IMEI="' . parseToXML($row['IMEI']) . '" ';
echo 'Velocity="' . parseToXML($row['Velocity']) . '" ';
echo 'Ora="' . parseToXML($row['Ora']) . '" ';
echo 'Data="' . parseToXML($row['Dat']) . '" ';
echo 'lat="' . $row['Latitudine'] . '" ';
echo 'lng="' . $row['Longitudine'] . '" ';
//echo 'type="' . $row['type'] . '" ';
echo '/>';
}
// End XML file
echo '</markers>';
}
我想補充有關圖標的代碼,這在我的情況是blueIcon:
var iconBlue = new GIcon();
iconBlue.image = 'http://labs.google.com/ridefinder/images/mm_20_blue.png';
iconBlue.shadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png';
iconBlue.iconSize = new GSize(12, 20);
iconBlue.shadowSize = new GSize(22, 20);
iconBlue.iconAnchor = new GPoint(6, 20);
iconBlue.infoWindowAnchor = new GPoint(5, 1);
感謝您的時間!
我剛剛更新了關於圖標代碼的代碼,問題是數字應該是動態的。所以從查詢的初始結果開始,它應該開始將它們編號到最後一個。 – pinky