Google maps api 3 谷歌地图按地址查看

Google maps api 3 谷歌地图按地址查看,google-maps-api-3,maps,Google Maps Api 3,Maps,我试图通过添加“地址”来查看谷歌地图。我得到了长和长,但没有显示。如果我手动添加横向和纵向,它会起作用 function initialize() { var geocoder = new google.maps.Geocoder(); geocoder.geocode( { 'address': '111 8th Avenue, New York, NY'}, function(results, status) {

我试图通过添加“地址”来查看谷歌地图。我得到了长和长,但没有显示。如果我手动添加横向和纵向,它会起作用

          function initialize() {
            var geocoder =  new google.maps.Geocoder();
            geocoder.geocode( { 'address': '111 8th Avenue, New York, NY'}, function(results, status) {
              if (status == google.maps.GeocoderStatus.OK) {
                var point =  new google.maps.LatLng( results[0].geometry.location.lat() + ", " +results[0].geometry.location.lng() );
                //alert( results[0].geometry.location.lat() + ", " +results[0].geometry.location.lng() );
                //var point = new google.maps.LatLng(40.7406578, -74.00208940000005);
                setTimeout(function(){
                  var mapOptions = {
                    zoom: 11,
                    center: point
                  };
                  var map = new google.maps.Map(document.getElementById('map-canvas'),
                      mapOptions);    
                  var marker = new google.maps.Marker({
                      position: point,
                      map: map,
                      title: "111 8th Avenue, New York, NY"
                  }); 
                }, 1000);
              }
            });
          }      
          google.maps.event.addDomListener(window, 'load', initialize);
线条(你在里面画了一条线)

必须是:

var point =  new google.maps.LatLng( results[0].geometry.location.lat() + ", " +results[0].geometry.location.lng() );
var point =  new google.maps.LatLng( results[0].geometry.location.lat() + ", " +results[0].geometry.location.lng() );
var point =  new google.maps.LatLng( results[0].geometry.location.lat(),  results[0].geometry.location.lng() );