dongzongpeng6474 2011-07-23 13:28
浏览 48
已采纳

如何将Numbers放在Google Map API标记上?

i'm using GoogleMap API in my project where the position of a particular vehicle is rendered by using data in the DB, i have already implemented this, MY question is if its possible to get numbers on the Markers,e.x Vehicle A has been in 100 places from 1 to 2 of Decembre, i would like having numbers starting from 1 to 100 kinda showing its path,This is the create marker function of my 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;
     }

This is the code used whose output is used by the googmapsapi.html, the output is a simple xml file with a number of number of "markers" tags containig info such as long,lat,date and time, could this list be used somehow to get the numbers out?

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

          }

I would like to add the code regarding the Icon, which in my case is a 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);

Thanks for your time!

  • 写回答

4条回答 默认 最新

  • dongpang2029 2011-07-23 13:57
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘