不知道你用的是Google地图哪个版本?Google Map v2 还是Google Map v3?
就拿Google Map V3来说吧?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>谷歌地图 v3</title>
    <script src="http://maps.google.com/maps/api/js?v=3.1&sensor=true" type="text/javascript"></script>
    
    <script type="text/javascript">
        var map;// 地图对象
        var directionsService = new google.maps.DirectionsService();
        var directionDisplay;
        var path = null,timer = 0,index = 0,er = null;
        function init() {
            directionsDisplay = new google.maps.DirectionsRenderer();
            var coor = new google.maps.LatLng(23.129163, 113.264435);
            map = new google.maps.Map(document.getElementById("map"), { zoom: 12, center: coor, mapTypeControl: false, mapTypeId: google.maps.MapTypeId.ROADMAP });            directionsDisplay.setMap(map);            var request = {
                origin: "广州市火车站",
                destination: "广州市番禺区汉溪长隆",
                optimizeWaypoints: true,
                travelMode: google.maps.DirectionsTravelMode.DRIVING
            };            // 获取从“广州市火车站”到“广州市番禺区汉溪长隆”的线路
            directionsService.route(request, function(response, status) {
                if (status == google.maps.DirectionsStatus.OK) {
                    directionsDisplay.setDirections(response);
                    path = response.routes[0].overview_path;
                    if (path) {
                        timer = window.setInterval(function() {
                            if (!er) {
                                er = new google.maps.Marker({ position: path[index++], map: map });
                            } else {
                                if (index < path.length) {
                                    er.setPosition(path[index++]);
                                } else {
                                    index = 0;
                                    window.clearInterval(timer);
                                }
                            }
                        }, 30);
                    }
                }
            });
        }
    </script>
</head>
<body onload="init();">
    <div id="map" style="width:800px; height:800px;"></div>
</body>
</html>

解决方案 »

  1.   

    如果是Google Map V2 也很简单,只要获取那个线路的所有坐标,再用个定时器,让一个标记定时改变坐标.当然改变的坐标是那个线路上的坐标...
      

  2.   

    http://www.gpsoo.net/track-history.jsp?objectID=65979  这种动态的是如何实现的啊
      

  3.   


    在导入Google地图的时候参数就需要提供版本那个参数啊...比如:<script src="http://maps.google.com/maps/api/js?v=3.1&sensor=true" type="text/javascript"></script>那个v=3.1就表示是3.1版的啊...
      

  4.   


    如果你是B/S结构,js肯定必不可少...
      

  5.   

    一般情况下地图都提供轨迹回放的功能,如mapabc,百度,都有,但google好像目前没有提供轨迹回放的api,只能自己先把所有的点连起来,然后手动用js设置一个定时器,隔一定间隔显示下个点来进行轨迹回放,但这有些牵强,最好的是,你将地图上的点的坐标转换为你屏幕的坐标,两个点之间移动时,你设置一个图像沿着这条线移动,并且要注意,图像的方向(这个gps终端上传上来的数据里一般都有,你可以根据角度来显示图像,如每15度一张图片)。