Foros del Web » Programando para Internet » Javascript »

Ayuda con API de google map y posicionamiento

Estas en el tema de Ayuda con API de google map y posicionamiento en el foro de Javascript en Foros del Web. Hola. llevo varios dias con problemas a la hora de que google me muestre los marker. El viernes pasado funcionaba perfectamente a la hora de ...
  #1 (permalink)  
Antiguo 26/11/2008, 02:36
 
Fecha de Ingreso: junio-2008
Mensajes: 21
Antigüedad: 15 años, 10 meses
Puntos: 0
Ayuda con API de google map y posicionamiento

Hola.

llevo varios dias con problemas a la hora de que google me muestre los marker. El viernes pasado funcionaba perfectamente a la hora de mostrarme todos los marker, pero cuando llego el lunes no los mostraba
el codigo es el siguiente
Código javascript:
Ver original
  1. <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=......." type="text/javascript"></script>
  2.  
  3. <script type="text/javascript">
  4.             //google.load("maps", "2");
  5.             var map = null;
  6.             //var puntosCoordenadas = "";
  7.             //var puntosDireccion = "";
  8.             var geocoder = null;
  9.             var tam;
  10.             var i;
  11.            
  12.             //var direccionesNoEncontradas = "";
  13.             //POSICIONO EL MAPA SEGUN LAS VARIABLES QUE LE PASO
  14.             //var centro = '<=(Session("loc") & ", " & Session("PAISINGLES"))%>';
  15.             var centro = vcity[0] + ', ' + vcountry[0] ;
  16.             //alert(centro);
  17.  
  18.             function initializeAll() {
  19.                 initializeMap();
  20.                
  21.                 for (var i = 0; i <= x ; i += 1) {
  22.                
  23.                 //if ((vlongitude != "" && vlatitude != "") && (vlongitude != null && vlatitude != null)){
  24.                     //AQUI ES DONDE AÑADO LAS MARCAS
  25.    
  26.                     anadeMarcadorCoordenadas(vlongitude[i],vlatitude[i],vaddress1[i],vcity[i],vname[i],vhotelId[i],i,vcountry[i],vpostalCode[i],vdisplayCurrencyCode[i],vdisplayRoomRate[i],vshortDescription[i],vthumbNailUrl[i]);
  27.                    
  28.                    // }
  29.                    // else{
  30. //                  anadeMarcadorDireccion();
  31.                   //  }
  32.                 }//FIN FOR
  33.                
  34.                 //alert(direccionesNoEncontradas);
  35.             }//FIN DE function initializeAll()
  36.            
  37.             //google.setOnLoadCallback(initializeAll);
  38.             // Call this function when the page has been loaded
  39.             function initializeMap() {
  40.            
  41.                 map = new GMap2(document.getElementById("map"));
  42.                 geocoder = new GClientGeocoder(); // para buscar por dirección
  43.                 //map.addControl(new GLargeMapControl());   //con barra de zoom
  44.                 map.addControl(new GSmallMapControl()); // controles para zoom, mover
  45.                 map.addControl(new GMapTypeControl()); // controles para mapa, satélite, híbrido
  46.                
  47.                
  48.                
  49.                
  50.                 if (centro == "") {
  51.                     map.setCenter(new GLatLng(39.926588, -3.164062), 2); // centro del mapa (longitud, latitud, zoom)
  52.                 } else {
  53.                     geocoder.getLatLng(centro, function(point) {
  54.                         if (!point) {
  55.                             map.setCenter(new GLatLng(39.926588, -3.164062), 1);
  56.                             alert("La ciudad solicitada no ha sido encontrada");
  57.                         } else {
  58.                             map.setCenter(point, 11);
  59.                             // alert(point);        mostramos las coordenadas
  60.                         }
  61.                     });
  62.                 }
  63.                
  64.                 //alert('Recuerde que solo se muestran los anuncios con coordenadas o con una dirección correcta.');
  65.             }//FIN function initializeMap()
  66.            
  67.             function anadeMarcadorCoordenadas(vlongitude, vlatitude, vaddress1, vcity, vname, vhotelId,i,vcountry,vpostalCode,vdisplayCurrencyCode,vdisplayRoomRate,vshortDescription,vthumbNailUrl) {
  68.                 //ESTE ALERT NO LO QUITO PORQUE SINO NO ME AÑADE LAS MARCAS
  69.                 if (i == 0) { alert("xxxxxxxx no garantiza la exactitud de la situacion en los mapas.\nConsulte telefonicamente la situacion en cada hotel directamente."); }
  70.                
  71.                 //alert(vlongitude + '/' + vlatitude + '/' + vaddress1 + '/' + vcity + '/' + vname + '/' + vhotelId);  
  72.                 var point = new GLatLng(vlatitude ,vlongitude);
  73.                 //var marker = new GMarker(point);
  74.                 var icono = new GIcon(G_DEFAULT_ICON, '../images/marcasgooglemap/'+(parseInt(i)+1)+' copia.gif');
  75.                 var marker = new GMarker(point, icono);
  76.                 GEvent.addListener(marker, "click", function() {
  77.                     //AQUI GENERO LAS ETIQUETAS
  78.                     var content = "<div style='width:25em'><font face='Courier new,Courier,monospace' color='#CC6633' size='1'>";
  79.                     content += "<table cellpadding='0' cellspacing='0'><tr><td colspan='2'>";
  80.                     content +='<span style="font-size:18px;font-weight:bold;">' + (parseInt(i)+1) + ')<a href="javascript:pulsarboton('+ vhotelId +');">' + vname + '</a></span>';
  81.                     content +="</td></tr><tr><td>";
  82.                     content +='<img src= '+ vthumbNailUrl +'  />';
  83.                     content +="</td><td>";
  84.                     content +="<span style='font-size:14px;'>" + vaddress1 + "<br/> " + vcity + ",<br/>"+ vpostalCode +", " + vcountry + "</span><br/><span  style='font-size:14px;font-weight:bold;'>Precio final: "+ vdisplayRoomRate + vdisplayCurrencyCode + "</span>";
  85.                     content +="</td></tr><tr><td colspan='2'>";
  86.                     content +="<span style='font-size:14px;'>" + String(vshortDescription).substring(0,100) + "... </span>";
  87.                     content +="</td></tr></table>";
  88.                     content += "</font></div>";
  89.                     marker.openInfoWindowHtml(content);
  90.                 });
  91.                 map.addOverlay(marker);
  92.                
  93.  
  94.             }//FIN function anadeMarcadorCoordenadas()
  95.            
  96.             //A TRAVES DE ESTE CODIGO NO LE PASO NADA DE INFORMACION DE MOMENTO
  97. //          function anadeMarcadorDireccion() {
  98. //          if (i == 0) { alert("WWW.XXXXXXXXXX.com"); }
  99. //              if (geocoder) {
  100. //                  geocoder.getLatLng(vcity + ', ' + vaddress1, function(point) {
  101. //                      if (!point) {
  102. //                          geocoder.getLatLng(vcity, function(point) {
  103. //                              if (!point) {
  104. //                                  //alert(direccion + ', ' + provincia + " no encontrada");
  105. //                                  //direccionesNoEncontradas += direccion + ', ' + provincia;
  106. //                              } else {
  107. //                                  var marker = new GMarker(point);
  108. //                                  //var icono = new GIcon(G_DEFAULT_ICON, 'http://www.casaspain.com/idiomas/bandera_espana.gif');
  109. //                                  //var marker = new GMarker(point, icono);
  110. //                                  map.addOverlay(marker);
  111. //                                  GEvent.addListener(marker, "click", function() {
  112. //                                      var content = "<div style='width:25em'><font face='Courier new,Courier,monospace' color='#CC6633' size='1'>";
  113. //                                      content += "<table cellpadding='0' cellspacing='0'><tr><td colspan='2'>";
  114. //                                      content +='<span style="font-size:24px;font-weight:bold;"><a href="javascript:pulsarboton('+ vhotelId +');">' + vname + '</a><span>';
  115. //                                      content +="</td></tr><tr><td>";
  116. //                                      content +='<img src=' + vthumbNailUrl + ' />';
  117. //                                      content +="</td><td>";
  118. //                                      content +="<h4>" + vaddress1 + "<br/> " + vcity + ",<br/>"+ vpostalCode + ", " + vcountry + "</h4>";
  119. //                                      content +="</td></tr><tr><td colspan='2'>";
  120. //                                        content +='<br/><h4>Total de la Estancia: '+ vdisplayRoomRate + vdisplayCurrencyCode +'</h4>'; // mostramos el precio total
  121. //                                        content +="</td></tr></table>";
  122. //                                        content += "</font></div>";
  123. //                                      marker.openInfoWindowHtml(content);
  124. //                                  });
  125. //                                  map.addOverlay(marker);
  126. //                              }
  127. //                          });
  128. //                      } else {
  129. //                          var icono = new GIcon(G_DEFAULT_ICON, 'http://www.xxxxxxxxx.com/idiomas/bandera_alemania.gif');
  130. //                          var marker = new GMarker(point);
  131. //                          map.addOverlay(marker);
  132. //                          GEvent.addListener(marker, "click", function() {
  133. //                              var content = "<div style='width:20em'><font face='Courier New, Courier, monospace' color='#CC6633' size='-1'>";
  134. //                              //content += marker.getPoint().lat() + " / " + marker.getPoint().lng(); // mostramos las coordenadas
  135. //                              content += "<h1>" + vname + "</h1>";
  136. //                              content += "<br />" + vaddress1 + ', ' + vcity;
  137. ////                                if (URL != '') {
  138. ////                                    content += "<br /><br /><a href='" + URL + "' target='_blank'>" + URL + "</a>";
  139. ////                                }
  140. //                              content += "<br /></font></div>";
  141. //                              marker.openInfoWindowHtml(content);
  142. //                          });
  143. //                          map.addOverlay(marker);
  144. //                      }
  145. //                  });
  146. //              }
  147. //          }
  148.            
  149.            
  150.            
  151.             ///////// ESTA FUNCION LLAMA AL BOTON CORRESPONDIENTE AL HOTEL SELECCIONADO DESDE EL GOOGLE MAP
  152.             function pulsarboton (boton){
  153.             var pulsa = document.getElementById(boton);
  154.                 if (pulsa){
  155.                         pulsa.click();  
  156.                         }
  157.            
  158.             }
  159.         </script>

He repasado el codigo, pero no veo el fallo o algo que pueda fallar.

Decir, que antes recojo las variables en un for asp, pero que dentro tengo codigo javascript

Código javascript:
Ver original
  1. <script type="text/javascript">
  2.          x = '<%=j %>';
  3.          vhotelId[x] = '<%=hotelId %>';
  4.          vname[x] = '<%=aname %>';
  5.          vaddress1[x] = '<%=address1 %>';
  6.          vcity[x] = '<%=city %>';
  7.          vlatitude[x] = '<%=latitude %>';
  8.          vlongitude[x] = '<%=longitude %>';
  9.          vpostalCode[x] = '<%=postalCode %>';
  10.          vthumbNailUrl[x] = '<%=thumbNailUrl %>';
  11.          vcountry[x] = '<%=country %>';
  12.          vdisplayCurrencyCode[x] = '<%=displayCurrencyCode %>';
  13.          vdisplayRoomRate[x] = '<%=displayRoomRate %>';
  14.          vshortDescription[x] = '<%=shortDescription %>';
  15. </script>
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 18:48.