2012-04-19 5 views
0

Google지도에서 한 지점에서 다른 지점으로 이동할 때 Google 어스에서 동일한 "바운스"기능을 구현할 수있는 방법이 있습니까? 예 : 나열된 지진 사이를 전환하면 http://earthquakeproject.com/?earth guier는 에있는 동일한 장소에서 지구의 위치를 ​​"바운스 (bounces)"합니다. http://earthquakeproject.com/?maps에서 동일한 작업을 수행하면 해당 위치로 간단히 미끄러집니다. 두 기능이 동일하게 느껴지도록 기능을 원합니다.Google지도의 지점 간 "수신 거부"API

답변

0

그래서 해결책을 찾지 못했습니다. 그래서 누군가 다른 사람이 똑같은 일을해야 할 때를 대비해서 제가 끝내었던 것입니다. 그래, 나는

먼저 나는 거리를 결정하는 함수를 발견했고, 1에서 다음 4

function sloc(lat,lon){ 
      sloc_obj.lat1=sloc_obj.lat2; 
      sloc_obj.lon1=sloc_obj.lon2; 
      sloc_obj.lat2=lat; 
      sloc_obj.lon2=lon; 
      var R = 6371; // km 
      var d = Math.acos(Math.sin(sloc_obj.lat1)*Math.sin(sloc_obj.lat2) + 
       Math.cos(sloc_obj.lat1)*Math.cos(sloc_obj.lat2) * 
       Math.cos(sloc_obj.lon2-sloc_obj.lon1)) * R; 

      if(d<1000){ 
       return 1; 
      } 
      if(d<5000){ 
       return 2; 
      } 
      if(d<10000){ 
       return 3; 
      } 
      return(4); 
     } 

에 이르기까지 상대 점프 금액을 마련하기 위해 그것을 사용 ... 그것은 깔끔한 될 수 알고 나는 ...

var l1=$(this).data('lat'); 
        var l2=$(this).data('lon'); 
        //set up array for times actions 
        var cmd=[] 
        //get the zoom-level based on the distance between two lat/lon spots 
        var d=sloc(l1, l2); 
        //based on our max flyout level, populate our times commands 
        if(d>=1){cmd[cmd.length]="map.setZoom(5)";} 
        if(d>=2){cmd[cmd.length]="map.setZoom(4)";} 
        if(d>=3){cmd[cmd.length]="map.setZoom(3)";} 
        if(d>=4){cmd[cmd.length]="map.setZoom(2)";} 
        cmd[cmd.length]="map.panTo(new google.maps.LatLng("+l1+","+l2+"),"+(1+d)+");"; 
        if(d>=4){cmd[cmd.length]="map.setZoom(3)";} 
        if(d>=3){cmd[cmd.length]="map.setZoom(4)";} 
        if(d>=2){cmd[cmd.length]="map.setZoom(5)";} 
        if(d>=1){cmd[cmd.length]="map.setZoom(6)";} 
        timer_offset=0; 

        //get the number of steps for our cmd iterator. subtract 1 so we get the middle step in our math since the number of steps will always be odd 
        steps=cmd.length-1 
        //iterate over ALL the steps. 
        for(x=0;x<=steps+1;x++){ 
         //for the middle step, wait a bit more than normal 
         if(x>=steps/2){ 
          timer_offset=(100*d); 
         } 
         //at the end of the middle action pan, wait a bit even more than that 
         if(x>=(steps/2)+1){ 
          timer_offset=(100*d)+200; 
         } 
         //set our timeout 
         time=200+(x*100+timer_offset) 
         //load the command on the timeout 
         setTimeout(cmd[x],time); 
        } 

내가 아웃을 통해 합리적으로 원활하게 전환 할 수이 방법을 시간 지연 조치 세트를 비틀하는 것을 사용하고 실제로 여행 거리의 양의 반사이다. 필자는 로그 깅이 더 쉽고 빠를 수 있도록 깔끔하게하려고 노력할 것이지만 플랫 패닝보다 낫습니다.

관련 문제