Foros del Web » Programando para Internet » Javascript »

Ubicar direcciones en google maps

Estas en el tema de Ubicar direcciones en google maps en el foro de Javascript en Foros del Web. HOLA A TODOS, INTENTO MOSTRAR UNA SERIE DE DIRECCIONES EN UN MAPA (mi BD es de 30 mil direcciones), PERO NO ME MUESTRA TODAS LAS ...
  #1 (permalink)  
Antiguo 21/03/2013, 14:43
 
Fecha de Ingreso: octubre-2008
Mensajes: 268
Antigüedad: 15 años, 6 meses
Puntos: 3
Ubicar direcciones en google maps

HOLA A TODOS, INTENTO MOSTRAR UNA SERIE DE DIRECCIONES EN UN MAPA (mi BD es de 30 mil direcciones), PERO NO ME MUESTRA TODAS LAS DIRECCIONES, ALGUIEN ME PODRIA APOYAR EN ESTO???... ES DECIR QUE CUANDO NO ENCUENTRA UNA DIRECCION, ENTONCES DEJA DE BUSCARLAS O DE COLOCARLAS... DONDE DIGO Q PASE A LA SIGUIENTE DIRECCION?... GRACIAS!


Código HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <title>Autentia: dinos donde se encuentra tu empresa</title>
    <script src="http://maps.google.com/maps?file=api&amp;v=2.x&amp;key=ABQIAAAAzr2EBOXUKnm_jVnk0OJI7xSosDVG8KKPE1-m51RBrvYughuyMxQ-i1QfUnH94QxWIa6N4U6MouMmBA" 
            type="text/javascript"></script>
    <script type="text/javascript">

    var map;
    var geocoder;
	var address=new Array();
<?php 
		set_time_limit(0);

		include 'ADO/Conexion.php';
		conectar_MSSQL();
		$result = mssql_query("SELECT TOP 50 DIR_GOOGLE, NSE, TELEFONO COORDENADAS FROM LIMA_MUNI");
		$i = 0;
		while ($row = mssql_fetch_array($result)){
?>
			address[<?php echo $i; ?>] = "<?php echo $row[0]; ?>";
<?php
 			$i = $i + 1;
		}
?>	
    function initialize() {
      map = new GMap2(document.getElementById("map_canvas"));
      map.setCenter(new GLatLng(-34.589229,-58.409836), 11);
      
      // insertar los controles
      map.addControl(new GSmallMapControl());
      map.addControl(new GMapTypeControl());
      
      geocoder = new GClientGeocoder();
    }

    // addAddressToMap() is called when the geocoder returns an
    // answer.  It adds a marker to the map with an open info window
    // showing the nicely formatted version of the address and the country code.
    function addAddressToMap(response) {
//      map.clearOverlays();
/*
     if (!response || response.Status.code != 200) {
	 	return 0;
//       alert("Lo sentimos, no se ha encontrado su direcci&ocute;n");
     } else {
*/	 
        place = response.Placemark[0];
        point = new GLatLng(place.Point.coordinates[1], place.Point.coordinates[0]);
        
        map.setCenter(point, 11);
        
        marker = new GMarker(point, {draggable: true});
        
        GEvent.addListener(marker, "dragstart", function() {
          map.closeInfoWindow();
        });

        GEvent.addListener(marker, "dragend", function() {
          document.getElementById("punto").value = marker.getLatLng().toUrlValue();
          marker.openInfoWindowHtml(place.address);
          generateKML(place.address, marker.getLatLng().lng(), marker.getLatLng().lat());
        });
        
        map.addOverlay(marker);
        marker.openInfoWindowHtml(place.address);
        document.getElementById("punto").value = marker.getLatLng().toUrlValue();
        
        generateKML(place.address, place.Point.coordinates[0], place.Point.coordinates[1]);
        
//      }
    }
	
    // showLocation() is called when you click on the Search button
    // in the form.  It geocodes the address entered into the form
    // and adds a marker to the map at that location.
    function showLocation() {
		for (var i = 0; i < address.length; i++) {
			geocoder.getLocations(address[i], addAddressToMap);
		}
		
    }

   // findLocation() is used to enter the sample addresses into the form.
    function findLocation(direccion, empresa ) {
      document.forms[0].q.value = direccion;
      document.getElementById("empresa").value = empresa;
      showLocation();
    }
    
    function generateKML(description, lng, lat){
      document.getElementById("kml").value = '';
      var kml = '<?xml version="1.0" encoding="UTF-8"?>\n';
      kml = kml + '<kml xmlns="http://earth.google.com/kml/2.2">\n';
      kml = kml + '<Placemark>\n';
      kml = kml + '\t<name>' + document.getElementById("empresa").value + '</name>\n';
      kml = kml + '\t<description>' + description + '</description>\n';
      kml = kml + '\t<Point><coordinates>' + lng + ',' + lat + ',0</coordinates></Point>\n'; 
      kml = kml + '</Placemark>\n';
      kml = kml + '</kml>\n'
      document.getElementById("kml").value = kml;
    }
    
    </script>
  </head>
<body onload="initialize()">
  
    <a href="javascript:void(0)" onclick="findLocation('Avenida de Castilla 2, San Fernando de Henares', 'Autentia');return false;">Ir a Autentia</a><br/>
    
    <p>
         <b>Escribe el nombre de tu empresa:</b>
         <input id="empresa" type="text" size="40"/>
    </p>
    
    <form action="#" onsubmit="showLocation(); return false;">
      
      <p>
        <b>Escribe aqu&iacute; tu direcci&oacute;n:</b>
        <input type="text" name="q" value="" class="address_input" size="40" />
        <input type="submit" name="find" value="Buscar" />
      </p>
    </form>
    
    <div id="map_canvas" style="width: 800px; height: 600px"></div>
    
    <p>
      <b>Coordenadas:</b>
      <input id="punto" type="text" size="40"/>
    </p>
  </body>
</html> 

Etiquetas: direcciones, google, html, input, maps, php, select, ubicar
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 21:42.