none
使用必应地图VEShape的时候,zoom‘缩放到8以上的时候,就看不见了 RRS feed

  • 问题

  • 我的代码如下:

    <script type="text/javascript" src="http://dev.ditu.live.com/mapcontrol/mapcontrol.ashx?v=6.2">

    </script>
     <script>

    function OnPageLoad()
    {
          map = new VEMap('info');
          map.LoadMap();
          map.HideDashboard(); 
          map.HideScalebar(); 

          var x_ = new VELatLong(39.92,116.46);
          map.SetCenterAndZoom(x_, 2);

          map.AttachEvent("onclick", function(){
            return false;
          });

    }

    function DrawLines(prototypeList){
    prototypeList_ = prototypeList;
    map.DeleteAllShapes();

    var points = new Array();

            for(var i = 0 ; i < prototypeList.length ; i++){          
               var x_ = new VELatLong( prototypeList[i].latitude,prototypeList[i].longitude);
               points.push(x_);
               if(prototypeList.length / 2 + 1 > i && prototypeList.length / 2 - 1 < i){
    map.SetCenterAndZoom(x_, 4);
               }
            }
    var x = new VEShape("Polyline", points);
    x.HideIcon();
            map.AddShape(x);

    }

    </script>

     <body onLoad="OnPageLoad()">

    <div id="info" style="font-size:10pt ; width:100% ; height:600px; ">
    </div>

    </body>

    这个在一开始展示的时候是可以正常显示的,但是一滑动鼠标滑轮,调整地图的Zoom,达到8以上的时候,就出现问题了,shape画的线就消失了。浏览器的控制台也开始报错

    报错信息如下:

    Error: Problem parsing points="1680,Infinity,1582,217,1400,244,1179,245,768,5,286,-302,142,-487,-25,-605,-5,-660,NaN,-681" mapcontrol.ashx?v=6.2:1

    Error: Problem parsing points="842,-242,854,-244,861,-236,883,-222,908,-241,935,-265,961,-288,993,-277,1008,-266,1014,-242,1026,-211,931,-56,887,61,637,449,328,367,146,394,-75,395,-486,155,-840,Infinity" mapcontrol.ashx?v=6.2:1

    Error: Problem parsing points="553,-124,565,-126,572,-118,594,-104,619,-123,646,-147,672,-170,704,-159,719,-148,725,-124,737,-93,642,62,598,179,348,567,39,485,-143,512,-364,513,-775,273,-840,Infinity" mapcontrol.ashx?v=6.2:1

    Uncaught InvalidStateError: Failed to execute 'dispatchEvent' on 'EventTarget': The event is already being dispatched. mapcontrol.ashx?v=6.2:149
    Error: Problem parsing points="1039,-167,1051,-169,1058,-161,1080,-147,1105,-166,1132,-190,1158,-213,1190,-202,1205,-191,1211,-167,1223,-136,1128,19,1084,136,834,524,525,442,343,469,122,470,-289,230,-771,-77,-840,Infinity" mapcontrol.ashx?v=6.2:1

    Uncaught InvalidStateError: Failed to execute 'dispatchEvent' on 'EventTarget': The event is already being dispatched. mapcontrol.ashx?v=6.2:149
    Error: Problem parsing points="1403,-83,1415,-85,1422,-77,1444,-63,1469,-82,1496,-106,1522,-129,1554,-118,1569,-107,1575,-83,1587,-52,1492,103,1448,220,1198,608,889,526,707,553,486,554,75,314,-407,7,-551,-178,-718,-296,-698,-351,-738,-485,-792,-547,-840,Infinity" mapcontrol.ashx?v=6.2:1

    Uncaught InvalidStateError: Failed to execute 'dispatchEvent' on 'EventTarget': The event is already being dispatched. mapcontrol.ashx?v=6.2:149
    Error: Problem parsing points="1649,-43,1661,-45,1668,-37,1680,Infinity,1444,648,1135,566,953,593,732,594,321,354,-161,47,-305,-138,-472,-256,-452,-311,-492,-445,-546,-507,-635,-558,-620,-602" mapcontrol.ashx?v=6.2:1

     我不知道为什么会出现  Infinity 和NaN

    这是不是错误的原因的呢,请问该如和解决。

    请教诸位,帮忙解答,谢谢。

    我在方法中输入的经纬度数据肯定是没有问题的,都是符合要求的正确数据。

    我在地图上展示的线路是一条跨越欧亚大陆的海上运输线

                                             
    • 已编辑 gkjiang 2014年10月8日 7:43
    2014年10月8日 7:40

答案

  • 你好,

    很抱歉不能重现你的问题,为了更好的解决这问题,希望你能提供一个可以运行的小demo(包括调用drawline function)


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • 已标记为答案 gkjiang 2014年10月9日 9:59
    2014年10月9日 2:47

全部回复

  • 你好,

    很抱歉不能重现你的问题,为了更好的解决这问题,希望你能提供一个可以运行的小demo(包括调用drawline function)


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • 已标记为答案 gkjiang 2014年10月9日 9:59
    2014年10月9日 2:47
  • 你好:

    感谢你的留言

    因为在要给你做demo的时候,我发现的问题的原因

    原来是因为没有将经纬度显式的转换为浮点数

    不过不知道为什么,没有转换的时候一开始是可以显式的,但是zoom改变之后就不可以了

    2014年10月9日 9:59