0

我正在尝试使用 V2 https://google-developers.appspot.com/maps/documentation/javascript/v2/examples/streetview-data?hl=es为 googlemaps 的 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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<title>Zone -</title>
<script type="text/javascript"
      src="http://maps.googleapis.com/maps/api/js?key=MY_KEY&sensor=false">
</script>
<script>   

$(function(){
function sleep(milliseconds) {
    var start = new Date().getTime();
    for (var i = 0; i < 1e7; i++) {
      if ((new Date().getTime() - start) > milliseconds){
        break;
      }
    }
}

initialize();
});


var map;
var myPano;   
var panoClient;
var nextPanoId;
var panorama;  
function initialize() {
      var mapOptions = {
        zoom: 8,
        center: new google.maps.LatLng(-34.397, 150.644),
        mapTypeId: google.maps.MapTypeId.ROADMAP
      }

      var fenwayPark = new google.maps.LatLng(42.345573,-71.098326);
    var fenwayPOV = {yaw:370.64659986187695,pitch:-20};

    map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
    panoClient = new google.maps.StreetViewService();      
      //map = new GMap2(document.getElementById("map_canvas"));
      map.setCenter(fenwayPark, 15);
      google.maps.event.addListener(map, "click", function(overlay, latlng) {
        // latlng will be null if the info window has been clicked.
        if (latlng) {
          panoClient.getNearestPanorama(latlng, showPanoData);
        }
      });

      var panoramaOptions = {
              position: fenwayPark,
              pov: {                  
                heading: 34,
                pitch: -20
              }
            };
      myPano = new google.maps.StreetViewPanorama(document.getElementById("pano"),panoramaOptions);
      //map.setStreetView(myPano);
      myPano.setPano(fenwayPark, fenwayPOV);

      google.maps.event.addListener(myPano, "error", handleNoFlash);  
      panoClient.getPanoramaByLocation(fenwayPark, 50, processSVData);
      //myPano.setStreetView(myPano);
}


function processSVData(data, status) {
      if (status == google.maps.StreetViewStatus.OK) {
        var marker = new google.maps.Marker({
          position: data.location.latLng,
          map: map,
          title: data.location.description
        });

        google.maps.event.addListener(marker, 'click', function() {

          var markerPanoID = data.location.pano;
          // Set the Pano to use the passed panoID
          myPano.setPano(markerPanoID);
          myPano.setPov({
            heading: 270,
            pitch: 0,
            zoom: 1
          });
          myPano.setVisible(true);
        });
      }
    }
</script>
</head>
<body>
</body>
</html>
4

0 回答 0