gpt4 book ai didi

php - 如何在 Google map API 标记上添加数字?

转载 作者:行者123 更新时间:2023-11-29 09:06:54 25 4
gpt4 key购买 nike

我在我的项目中使用GoogleMap API,其中特定车辆的位置是通过使用数据库中的数据来呈现的,我已经实现了这个,我的问题是是否可以获取标记上的数字,例如车辆A从 12 月 1 日到 2 日已经去过 100 个地方,我希望有从 1 到 100 开始的数字来显示它的路径,这是我的 Google 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 文件,其中包含许多“标记”标签,其中包含长、纬度、日期和时间等信息,可以将此列表列出吗以某种方式用来获取数字?

         // 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>';

}

我想添加有关图标的代码,在我的例子中是一个蓝色图标:

       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);

感谢您的宝贵时间!

最佳答案

关于php - 如何在 Google map API 标记上添加数字?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6800689/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com