Foros del Web » Programando para Internet » Javascript »

Google maps API

Estas en el tema de Google maps API en el foro de Javascript en Foros del Web. Hola todos. Bueno a ver si algún me puede ayudar, cero hacer google maps API necesito que puedo elegir una región y aparezca una un ...
  #1 (permalink)  
Antiguo 15/03/2010, 10:12
 
Fecha de Ingreso: marzo-2010
Ubicación: Buenos Aires
Mensajes: 25
Antigüedad: 14 años, 1 mes
Puntos: 2
Google maps API

Hola todos. Bueno a ver si algún me puede ayudar, cero hacer google maps API necesito que puedo elegir una región y aparezca una un marcador en la región que elegí y abajo los links con sucursales que tengo en esta región. Si algún tiene algo parecido o me pueda ayudar se agradezco acá dejo un código que ya arme pero no anda bien:

Código:
<?php
include ("../includes/config.php");

$SQLDSC = mysql_query("SELECT DISTINCT * FROM provincias LEFT JOIN provincias_ciudades ON provincias.Cod_Provincia = provincias_ciudades.Cod_Provincia LEFT JOIN ciudades ON provincias_ciudades.Cod_Ciudad = ciudades.Cod_Ciudad WHERE ciudades.Cod_Ciudad IS NOT NULL ORDER BY ciudades.Ciudad");

$SQLDRPC = mysql_query("SELECT DISTINCT *, provincias.Provincia AS provincia_name FROM provincias LEFT JOIN provincias_ciudades ON provincias.Cod_Provincia = provincias_ciudades.Cod_Provincia LEFT JOIN ciudades ON provincias_ciudades.Cod_Ciudad = ciudades.Cod_Ciudad LEFT JOIN repuesteros ON ciudades.Cod_Ciudad = repuesteros.Localidad AND provincias.Cod_Provincia = repuesteros.Provincia WHERE ciudades.Cod_Ciudad IS NOT NULL ORDER BY ciudades.Ciudad");
$i=0;
while($SQLRPC=mysql_fetch_array($SQLDRPC)){
	$datos_repuestteros["provincia"][$i]=$SQLRPC["provincia_name"];	
$i++;
}

?>
<!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>Google Maps JavaScript API Example: 	Extraction of Geocoding Data</title>
    <script src="http://maps.google.com/maps?file=api&amp;v=2.x&amp;key=key" 
            type="text/javascript"></script>
    <script type="text/javascript">

    var map;
    var geocoder;

    function initialize() {
      map = new GMap2(document.getElementById("map_canvas"));
      map.setCenter(new GLatLng(-34.637249, -58.415733), 13);
      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) {
        alert("Sorry, we were unable to geocode that address");
      } else {
        place = response.Placemark[0];
        point = new GLatLng(place.Point.coordinates[1],
                            place.Point.coordinates[0]);
        marker = new GMarker(point);
        map.addOverlay(marker);
        marker.openInfoWindowHtml(place.address + '<br>' +
          '<b>Country code:</b> ' + place.AddressDetails.Country.CountryNameCode);
      }
    }

    // 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() {
      var address = document.forms[0].q.value;
	  geocoder.getLocations(address, addAddressToMap);
	  
    }
   // findLocation() is used to enter the sample addresses into the form.
    function findLocation(address) {
      document.forms[0].q.value = address;
      showLocation();
	  geocoder.getAddres();
    }
	
	
	function getAddres(){
		//var rep_dir = explode(',', address);
		//var A;
		 if ( "BUENOS AIRES" == "BUENOS AIRES" ){ A = ["lallaa"];}
		
		var s2 = document.getElementById( "sel2" );
    while ( s2.firstChild ){ s2.removeChild( s2.firstChild );}
    for ( var i = 0; i < A.length; i++ ) {
	if ( !A[ i ] ) {continue;}
	
	  
		var o; 
		o = document.createElement("a");
		var href = document.createAttribute('href'); 
		o.setAttribute('href','http://www.afcc1.com'); 
		o.innerText ="LALA"; 
		var spanAppend = document.getElementById('myDivLink'); 
		spanAppend.appendChild(o);
		
		 s2.appendChild( o );

    }
		
	}
    </script>
  </head>

  <body onload="initialize()">

    <!-- Creates a simple input box where you can enter an address
         and a Search button that submits the form. //-->
    <form action="#" onsubmit="showLocation(); return false;" method="post">
      <select name="q">
      	<option>Select capital</option>
      <?php
	  	while($SQLSC=mysql_fetch_array($SQLDSC)){
	  ?>
        <option value="<?php echo 'Argentina, '.$SQLSC["Provincia"].', '.$SQLSC["Ciudad"] ?>"><?php echo $SQLSC["Provincia"].', '.$SQLSC["Ciudad"] ?></option>
	 <?php
		}
	  ?>
      </select>
      <input type="submit" value="OK" />
    </form>
    <div id="map_canvas" style="width: 500px; height: 300px"></div>

   <!-- Sample addresses //-->
   <p><b>Try these:</b><br />

   <!--<a href="javascript:void(0)"
     onclick="findLocation('1600 amphitheatre mountain view ca');return false;">1600
     amphitheatre mountain view ca</a><br />-->

   
     
   <div id="sel2">1</div>
  </p>
  </body>
</html>

Última edición por georgiy_84; 15/03/2010 a las 10:17

Etiquetas: api, google, maps
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 15:50.