2014-07-10 4 views
-1

안녕하세요 저는 Google API v 3.0을 사용하여 스트리트 뷰를 표시하고 있지만 스트리트 뷰에는 프탈리 틱 포인트가 표시되지 않지만 maps.google.com은이 위치에 대한 스트리트 뷰를 표시하고 있습니다. 내가 잘못한 곳.스트리트 뷰 google api 사용

내 코드는 다음과 같습니다 : - 거리에 대한

<!DOCTYPE html> 
    <script src="http://code.jquery.com/jquery-1.9.1.js"></script> 
    <html> 
    <head> 
    <meta charset="utf-8"> 
    <title>Street View service</title> 
    <style> 
    html, body, #map-canvas { 
    height: 100%; 
    margin: 0px; 
    padding: 0px 
    } 
    </style> 
    <script src="https://maps.googleapis.com/maps/api/js?v=3.exp"></script> 
    <script> 

var latitude=null; 
var longitude=null; 
    var fenway; 
    var map; 
    var panoramaOptions; 
    function initialize() { 

    var value = '950 COUNTRY CLUB DRIVE, MORAGA 94556 '; 
    alert("value"+value); 
    var infoWindow = new google.maps.InfoWindow; 
    $.ajax({ 
    url:"http://maps.googleapis.com/maps/api/geocode/json?address="+value+"&sensor=false", 
    type: "POST", 
    success:function(res){ 
    latitude=res.results[0].geometry.location.lat; 
    alert("latitude"+latitude); 
    longitude=res.results[0].geometry.location.lng; 
    alert("longitude"+longitude); 
    } 
}); 
fenway = new google.maps.LatLng(latitude,longitude); 
var mapOptions = { 
center: fenway, 
    zoom: 14 
    }; 
    var map = new google.maps.Map(
    document.getElementById('map-canvas'), mapOptions); 
    var panoramaOptions = { 
    position: fenway, 
    pov: { 
    heading: 34, 
    pitch: 10 
    } 
    }; 
    var panorama = new   google.maps.StreetViewPanorama(document.getElementById('pano'),panoramaOptions); 
    map.setStreetView(panorama); 
    } 
google.maps.event.addDomListener(window, 'load', initialize); 
</script> 
</head> 
    <body> 
    <div id="map-canvas" style="width: 400px; height: 300px"></div> 
    <div id="pano" style="position:absolute; left:410px; top: 8px; width: 400px; height: 300px;"></div> 
    </body> 
    </html> 
+0

누구든지 어떤 생각이있어, 제발 도와주세요. – Mangita

+1

'fenway' 변수를 테스트하십시오. '위도'와 '경도'는 변수를 사용할 때 아직 설정되지 않았습니다. 이는 ajax 요청이 비동기 적이기 때문입니다. – MrUpsidown

답변

관련 문제