views:

10

answers:

0

Hello,

what I want to archieve is the geocode an address put in by the user and this displays as a marker in google maps and at same time based on the location displays the result in panorama streetview. See my code below, I' having errors. Any help please!!!!

var geocoder; var map; function initialize() { geocoder = new google.maps.Geocoder(); var latlng = new google.maps.LatLng(-34.397, 150.644); var myOptions = { zoom: 8, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP } map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); }

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 });

var point = new google.maps.LatLng((results[0].geometry.location) ); panoramaOptions = { latlng:point }; pano = new google.maps.StreetViewPanorama( document.getElementById( "streetview" ), panoramaOptions );

            google.maps.event.addListener( pano ); 
            google.maps.eveny.addListener( pano, "error", handleNoFlash ); 
   // }
    function handleNoFlash( code ) 
    { 
            if ( code == StreetviewPanorama.ErrorValues.FLASH_UNAVAILABLE ) 
                    alert( 'You need flash player to view the panorama.' ); 

}

//var panorama = new google.maps.StreetViewPanorama(document.getElementById("pano"),panoramaOptions);

  } else {
    alert("Geocode was not successful for the following reason: " + status);
  }
});

}