Foros del Web » Programando para Internet » Javascript »

Problema con google streetview

Estas en el tema de Problema con google streetview en el foro de Javascript en Foros del Web. Buenas tardes y gracias por vuestra ayuda :) Tengo un problema con javascript que me trae loco y que seguro que es una estupidez, pero ...
  #1 (permalink)  
Antiguo 29/01/2010, 10:44
 
Fecha de Ingreso: diciembre-2007
Mensajes: 5
Antigüedad: 16 años, 4 meses
Puntos: 0
Problema con google streetview

Buenas tardes y gracias por vuestra ayuda :)

Tengo un problema con javascript que me trae loco y que seguro que es una estupidez, pero no soy capaz de verlo. Mis conocimientos de javascript son limitaditos :(

El caso es que tengo un script que muestra un mapita de google y debajo la vista de google streetview con las mismas coordenadas, con una función para que al pinchar en el mapa de google te actualice la vista en streetview.

El script funciona, pero da un error en la consola de firebug: 'panorama.setlocation is not a function'. El caso es que firefox pasa del tema, pero IE da un mensaje muy, muy feo.

Ahí va el código:

<script type="text/javascript">

function initialize() {
if (GBrowserIsCompatible()) {

var NearestPan;
var marker2;
var panorama;

var location = new GLatLng(<?php echo $latitude;?>, <?php echo $longitude;?>);

function NearestPan(inPoint) {
if (inPoint != null) {
document.getElementById("pano").style.display = "block";
panorama = new GStreetviewPanorama(window.document.getElementById ("pano"));
panorama.setLocation(inPoint);
}
else{
//panorama.setLocation(location);
}
}



//google maps
var map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(<?php echo $latitude;?>, <?php echo $longitude;?>), <?php echo $zoom;?>);


var marker = new GMarker(location);

map.addOverlay(marker);

// Add the Controls to the map
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.enableDoubleClickZoom();

var myPano;

// set up streetview
var fenwayPark = new GLatLng(<?php echo $latitude;?>, <?php echo $longitude;?>);

panoramaOptions = { latlng:fenwayPark };
myPano = new GStreetviewPanorama(document.getElementById("pano" ), panoramaOptions);

var point = new GLatLng(<?php echo $latitude;?>, <?php echo $longitude;?>);

var streetOverlay = new GStreetviewOverlay();
var streetviewClient = new GStreetviewClient();
streetviewClient.getNearestPanoramaLatLng(point, NearestPan);

GEvent.addListener(marker, 'mouseover', function() {
marker.openInfoWindowHtml('<div style="text-align:center"><p><strong><?php echo $data['Property_Refrence'];?>: <?php echo $pro['pro_refrence'];?></strong><br/></p><img width="200" style="border:1px solid #ccc; overflow:hidden; margin:0 auto;" src="images/properties/<?php echo $pro['pro_photo'];?>" /><p style="text-align:right"><br/><strong><?php echo $data['Property_Price'];?>: <?php if($pro['pro_price']==0){echo $data['consult'];}else{echo $pro['pro_price'];}?></strong></p><div style="clear:both;"></div><br/></div>')
});


GEvent.addListener(map,"click", function(overlay,latlng) {

//fijamos posici�n del panorama seg�n mapa
panorama.setLocationAndPOV(latlng);

//quitamos marcadores
map.clearOverlays();

//volvemos a poner el marcador de la casa
var marker = new GMarker(location);
GEvent.addListener(marker, 'mouseover', function() {
marker.openInfoWindowHtml('<div style="text-align:center"><p><strong><?php echo $data['Property_Refrence'];?>: <?php echo $pro['pro_refrence'];?></strong><br/></p><img width="200" style="border:1px solid #ccc; overflow:hidden; margin:0 auto;" src="images/properties/<?php echo $pro['pro_photo'];?>" /><p style="text-align:right"><br/><strong><?php echo $data['Property_Price'];?>: <?php if($pro['pro_price']==0){echo $data['consult'];}else{echo $pro['pro_price'];}?></strong></p><div style="clear:both;"></div><br/></div>')});
map.addOverlay(marker);

// ponemos marcador del streetview
var icon = new GIcon();
icon.image = "images/icono_google.png";
icon.shadow = "";
icon.iconSize = new GSize(20, 34);
icon.shadowSize = new GSize(0, 0);
icon.iconAnchor = new GPoint(9, 34);
icon.infoWindowAnchor = new GPoint(31, 8);

var marker2 = new GMarker(latlng, icon);
map.addOverlay(marker2);

});


}
}


</script>

Podeis ver un ejemplo en ejecución aqui:

http://www.tmgrupo.ru/detail.php?pro_id=88

Alguien tiene idea de por qué pasa y cómo solucionarlo? Gracias a todos por vuestra ayuda.

Etiquetas: google
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 03:47.