Ver Mensaje Individual
  #1 (permalink)  
Antiguo 20/09/2012, 13:41
Avatar de maximendez88
maximendez88
 
Fecha de Ingreso: septiembre-2012
Ubicación: Montevideo
Mensajes: 131
Antigüedad: 11 años, 7 meses
Puntos: 3
Pregunta unir marcadores con google maps

buenas estoy intentando marcar una ruta con el google maps... en mi formulario pido que se agreguen ciudades y quiero que cada vez que se agrega una ciudad, este unida con una linea... he logrado que cada vez que agrego una ciudad lo haga en diferentes marcadores... lo que aun no puedo lograr es que estos marcadores esten unidos con una linea... alguien puede echarme una mano?

este es mi codigo de google maps

Código HTML:


 <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=AIzaSyA07VHJApYzXc3uJgFEk4l04KaSABLyaVA"
      type="text/javascript"></script>
    <script type="text/javascript">

    var map = null;
    var geocoder = null;
	
    function initialize() {
      if (GBrowserIsCompatible()) {
		  
        map = new GMap2(document.getElementById("map_canvas"));
        map.setCenter(new GLatLng(37.4419, -122.1419), 1);
		map.setMapType(G_HYBRID_MAP);
        map.setUIToDefault();
        geocoder = new GClientGeocoder();
      }
    }
	
	

    function showAddress(address) {
      if (geocoder) {
        geocoder.getLatLng(
          address,
          function(point) {
            if (!point) {
              alert(address + " not found");
            } else {
				
				
				
              map.setCenter(point, 6);
              var marker = new GMarker(point, {draggable: true});
              map.addOverlay(marker);
			  
			  
			  map.addOverlay(polyline);
			  
			  
			  
              
			  
			  
			  GEvent.addListener(marker, "dragend", function() {
                
				 document.getElementById('lat').value=marker.getPoint().lat();
                 document.getElementById('long').value=marker.getPoint().lng();
              });
              GEvent.addListener(marker, "click", function() {
                
				 document.getElementById('lat').value=marker.getPoint().lat();
                 document.getElementById('long').value=marker.getPoint().lng();
              });
			  
			  
			  
			  
	      GEvent.trigger(marker, "click");
            }
          }
        );
      }
    }
	
	
	
	
 

	
    </script>