Ver Mensaje Individual
  #7 (permalink)  
Antiguo 22/02/2013, 01:21
Avatar de madman_18
madman_18
 
Fecha de Ingreso: agosto-2010
Mensajes: 792
Antigüedad: 13 años, 8 meses
Puntos: 14
Respuesta: Problema con Google Maps

Cita:
Iniciado por ipraetoriux Ver Mensaje
...pues utiliza el metodo setZoom aplicado al mapa, y le das un numero de cuanto zoom quieres....seria despues del codigo que te pase antes...

Código Javascript:
Ver original
  1. map.setZoom(5)
Sí, lo he establecido pero se me queda al máximo siempre

He probado a quitarlo de opciones y a dejarlo, a parte de poner el map.setZoom(17); y nada....

Pongo el código por si hay alguna errata....

Código Javascript:
Ver original
  1. // SE GENERA EL MAPA
  2.     var mapita = new google.maps.LatLng(37.35,-5.221102);
  3.     var bounds = new google.maps.LatLngBounds();
  4.     /*****************/    
  5.     // SE LE DAN LAS OPCIONES ZOOM - CENTER (DONDE ESTARÍA EL "CENTRO" DEL MAPA) - TIPO DE MAPA
  6.     var opciones = {};
  7.     opciones = {
  8.         zoom: 17,
  9.         center: mapita,
  10.         mapTypeId: google.maps.MapTypeId.SATELLITE
  11.     };
  12.     /***************************************************************************************/    
  13.     // DIV DONDE SE VA A CREAR EL MAPA Y SE CREA EL MAPA
  14.         var div = document.getElementById('mapa_contenedor');
  15.         var map = new google.maps.Map(div,opciones);        
  16.     /*****************************************************/
  17.     // SE GENERA EL MARCADOR Y SE PONE EN EL MAPA
  18.     var marcador = new google.maps.Marker({
  19.         position: mapita,
  20.         map: map,
  21.         draggable:false,
  22.         animation: google.maps.Animation.BOUNCE,
  23.         title: 'Nos encontramos aquí'        
  24.     });
  25.     /********************************************/
  26.     // DATOS QUE SE QUIERE EN LA VENTANA INFO
  27.     var contenido = '<div class=contenedor_infoMapas>\n\
  28.                   <table class=tabla_empresa>\n\
  29.                    <tr>\n\
  30.                        <td id=titulo_empresa><b><a href=https://maps.google.es/maps?q=Agr%C3%ADcola+Lantejuela+S.+Coop.+And.,+Sevilla&hl=es&ie=UTF8&ll=37.358697,-5.221102&spn=0.006839,0.016512&sll=40.396764,-3.713379&sspn=13.411907,33.815918&oq=agr%C3%ADcola+lantejuela+sevilla&hq=Agr%C3%ADcola+Lantejuela+S.+Coop.+And.,&hnear=Sevilla,+Andaluc%C3%ADa&t=h&z=17 target=_blank> minombre</a></b></td></tr></table><br/>\n\
  31.                    <table id=describe_empresa>\n\
  32.                        <tr>\n\
  33.                           <td>dato1</td>\n\
  34.                        </tr>\n\
  35.                        <tr>\n\
  36.                            <td>dato3</td></tr><tr><td>dato2</td>\n\
  37.                        </tr>\n\
  38.                        <tr>\n\
  39.                            <td><a href=# title="Contacte con nosotros">el email</a></td>\n\
  40.                        </tr>\n\
  41. </div>\n\
  42. </table>';
  43.    /*****************************************/
  44.    /*SE CREA EL OBJETO VENTANA INFO*/
  45.    var infowindow = new google.maps.InfoWindow({content: contenido});  
  46.     bounds.extend(mapita);
  47.     map.setCenter(bounds.getCenter());
  48.     map.fitBounds(bounds);
  49.     map.setZoom(17);
  50.    //CON ESTO SE LE AÑADE EL EVENTO CLICK SOBRE EL MARCADOR POR SI LO CIERRAN MOSTRARÍA EL MAPA DE NUEVO.
  51.    google.maps.event.addListener(marcador, 'click', function(){
  52.        infowindow.open(map, marcador);
  53.        marcador.animate('none');
  54.     });

Edito: Pongo todo el código por si hay algún error o algo :S
__________________
"Si consigues ser algo más que un hombre, si te entregas a un ideal, te convertes en algo muy diferente"

Última edición por madman_18; 22/02/2013 a las 01:40 Razón: Amplio el código