Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/google-maps/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 谷歌地图V3:初始化街景&x2B;地理编码_Javascript_Google Maps - Fatal编程技术网

Javascript 谷歌地图V3:初始化街景&x2B;地理编码

Javascript 谷歌地图V3:初始化街景&x2B;地理编码,javascript,google-maps,Javascript,Google Maps,Daer我在我的项目中设置了谷歌地图,效果很好。现在我想用“街景全景”而不是标准地图来初始化以下脚本 我在google开发者上找到了一个例子,但我无法将它与地理编码功能结合起来 那么,如果我想在这段代码中初始化街景而不是标准地图,该怎么办 var geocoder; var map; function initialize() { geocoder = new google.maps.Geocoder(); var latlng = new google.maps.LatLn

Daer我在我的项目中设置了谷歌地图,效果很好。现在我想用“街景全景”而不是标准地图来初始化以下脚本

我在google开发者上找到了一个例子,但我无法将它与地理编码功能结合起来

那么,如果我想在这段代码中初始化街景而不是标准地图,该怎么办

  var geocoder;
  var map;
  function initialize() {
  geocoder = new google.maps.Geocoder();
  var latlng = new google.maps.LatLng(-34.397, 150.644);
  var mapOptions = {
  zoom: 16,
  center: latlng,
  mapTypeId: google.maps.MapTypeId.ROADMAP
  }
  map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions);
  }//*I need street view instead of standard map (StreetViewPanorama)

  function codeAddress() {
  var address = document.getElementById("address").value;
  geocoder.geocode( { 'address': address}, function(results, status) {
  if (status == google.maps.GeocoderStatus.OK) {
    map.setCenter(results[0].geometry.location);
    var marker = new google.maps.Marker({
        map: map,
        position: results[0].geometry.location
    });
   } else {
    alert("Geocode was not successful for the following reason: " + status);
  }
 });
 }
html


 <div id="map-canvas" style="width: 600px; height: 450px; float:right"></div>
 <div>
 <input id="address" type="text" value="Milan, Italy Viale Tunisia 30">
 </div>