注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

快乐小屋

 
 
 

日志

 
 

基于ArcGIS for javascript api 轨迹回放  

2013-04-28 10:23:30|  分类: Javascript |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

源码如下:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
  <head>
    <meta. http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>Simple Map</title>
    <link rel="stylesheet" type="text/css" href="http://tonggc1668.blog.163.com/blog/http://esri-guo/arcgis_js_v32_sdk/arcgis_js_api/library/3.2/jsapi/js/dojo/dijit/themes/tundra/tundra.css"/>
    <link rel="stylesheet" type="text/css" href="http://tonggc1668.blog.163.com/blog/http://esri-guo/arcgis_js_v32_sdk/arcgis_js_api/library/3.2/jsapi/js/esri/css/esri.css" />
    <script. type="text/javascript" src="http://tonggc1668.blog.163.com/blog/http://esri-guo/arcgis_js_v32_sdk/arcgis_js_api/library/3.2/jsapi/init.js"></script>
    <script. type="text/javascript">
        dojo.require("esri.map");
        dojo.require("esri.toolbars.draw");
        dojo.require("esri.graphic");
        dojo.require("esri.layers.graphics");
        dojo.require("esri.geometry");
        var ptcount = "13740395.6058,5130594.7971/13740385.6058,5130594.7971/13740375.6058,5130594.7971/13740365.6058,5130594.7971/13740355.6058,5130594.7971/13740355.6058,5130583.7971/13740355.6058,5130572.7971/13740355.6058,5130561.7971/13740355.6058,5130550.7971/13740355.6058,5130549.7971/13740355.6058,5130538.7971/13740355.6058,5130527.7971/13740355.6058,5130516.7971/13740355.6058,5130505.7971/13740355.6058,5130494.7971/13740355.6058,5130483.7971/13740355.6058,5130472.7971/13740355.6058,5130461.7971/13740355.6058,5130450.7971/13740355.6058,5130449.7971/13740355.6058,5130438.7971/13740355.6058,5130427.7971/13740355.6058,5130416.7971/13740355.6058,5130405.7971/13740355.6058,5130394.7971/13740355.6058,5130383.7971/13740355.6058,5130372.7971/13740355.6058,5130361.7971/13740355.6058,5130350.7971/13740355.6058,5130349.7971/13740355.6058,5130328.7971/13740355.6058,5130317.7971/13740355.6058,5130306.7971/13740355.6058,5130295.7971/13740355.6058,5130284.7971/13740355.6058,5130273.7971/13740355.6058,5130262.7971/";
        var list;
        var defaultSymbol;
        var myMap;
        var icount;
        var i = 0;
        function ptcounntSplit() {
            list = ptcount.split("/");
           icount= list.length;
            //alert(list[0].substring(0,list[0].indexOf(',')));
            //alert(list[0].substring(list[0].indexOf(',')+1, list[0].length));
        }
        function ptPosition() {


            var pointSymbol = new esri.symbol.SimpleMarkerSymbol();
            pointSymbol.setOutline = new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255, 0, 0]), 1);
            pointSymbol.setSize(5);
            pointSymbol.setColor(new dojo.Color([0, 255, 0, 0.25]));
       
            var geometry = new esri.geometry.Point(13740395.6058, 5130594.7971);
       
            var graphic = new esri.Graphic(geometry, pointSymbol);


            myMap.graphics.add(graphic);

           // var point = new esri.geometry.Point({ "x": 13740395.6058, "y": 5130594.7971, " spatialReference": { " wkid": 102100} });
            myMap.centerAndZoom(geometry, 20);

        }
      
        function go() {


          
            var pointSymbol = new esri.symbol.SimpleMarkerSymbol();
            pointSymbol.setOutline = new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255, 0, 0]), 1);
            pointSymbol.setSize(5);
            pointSymbol.setColor(new dojo.Color([0, 255, 0, 0.25]));
            //alert(list[i]);
            var geometry = new esri.geometry.Point(list[i].substring(0, list[i].indexOf(',')), list[i].substring(list[i].indexOf(',') + 1, list[i].length));

            var graphic = new esri.Graphic(geometry, pointSymbol);


            myMap.graphics.add(graphic);
        
            var extent = myMap.extent;
            if (!extent.contains(graphic.geometry)) {
                myMap.centerAt(geometry);
            }

  
              i++;
            
   
        }


        function gogps() {
         
            go();
            if (i < icount) {
                            window.setTimeout("gogps()", "2000");
            }
            else {
                            window.clearTimeout("gogps()");
            }
          


        }
     
      function init() {
        //var myMap = new esri.Map("mapDiv");
          var customExtentAndSR = new esri.geometry.Extent(13676444.4499247, 5092822.83792968, 13781163.1786753, 5160163.85984883, new esri.SpatialReference({ "wkid": 102100}));

          myMap = new esri.Map("mapDiv", {extent:customExtentAndSR});


        //note that if you do not have public Internet access then you will need to point this url to your own locally accessible cached service.
        var myTiledMapServiceLayer = new esri.layers.ArcGISTiledMapServiceLayer("http://www.arcgisonline.cn/ArcGIS/rest/services/ChinaCities_Community_BaseMap_CHN/ShenYang_Community_BaseMap_CHN/MapServer");
        myMap.addLayer(myTiledMapServiceLayer);

 
      }
      dojo.addOnLoad(init);
    </script>
  </head>
  <body class="tundra">
    <table>
      <tr>
          <td>
             <div id="mapDiv" style="width:1500px; height:800px; border:1px solid #000;"></div>
          </td>
          <td>
             <input id="Button1" type="button" value="定位" nclick='ptPosition()' />

             <input id="Button2" type="button" value="回放" nclick=' ptcounntSplit();gogps()'/>
          </td>
      </tr>
     
    
    </table>
  </body>
</html>

  评论这张
 
阅读(1205)| 评论(0)
推荐 转载

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018