 
			
				27/06/2010, 13:14
			
			
			     |  
      |    |    |    Fecha de Ingreso: junio-2010  
						Mensajes: 20
					  Antigüedad: 15 años, 4 meses Puntos: 0     |        |  
  |      Marcadores arrastrables en api google maps        Hola. En primer lugar quiero saludaros a todos los que contribuís en este foro, gracias por anticipado.   
Bueno, mi consulta tiene que ver con google maps y su api. El código que pego bajo estas líneas dibuja un mapa de google en el navegador tras pasarle la dirección.  
Si os fijáis he puesto un marcador arrastrable map.addOverlay( new GMarker ( point, {draggable: true} ) );  
Lo que pretendo es que cada vez que un usuario arrastre el marcador y lo suelte una función me devuelva las nuevas coordenadas en las que se ha posicionado dicho marcador.  
Gracias por anticipado.     
<!DOCTYPE html "-//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"> 
  <head> 
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/> 
    <title>Gran Acontecimiento, Gran</title> 
    <script    
src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAGDCtEJ2LP-FcQXamIXPVpRQuqf   
vn_lukP2THRZmjJCwlh0EO3RTEeDmSL5Wz-7uBqMXyn1HzPtIfWg&sensor=true" 
            type="text/javascript"></script> 
    <script type="text/javascript">   
	//pasamos la direccion por la variable calle 
var calle='blasco ibañez, valencia'; 
    var map = null; 
    var geocoder = null; 
    var htm=['<strong>Banquete</strong><br />Ruggieri 2736<br /><img    
src="http://www.php-hispano.net/avatar/unknown.jpg" />']; 
    var scope={} 
    function initialize() { 
      if (GBrowserIsCompatible()) { 
        map = new GMap2(document.getElementById("map_canvas")); 
        scope.contador=0; 
        geocoder = new GClientGeocoder(); 
        showAddress('calle yecla 69, valencia');     
      } 
    }     
    function showAddress(address) {   
        if (geocoder) {   
            geocoder.getLatLng( 
              address, 
              function(point) { 
                if (!point) { 
                      alert(address + " not found"); 
                } else { 
                      map.setCenter(point, 17); 
                    var mapControl = new GMapTypeControl(); 
                    map.addControl(mapControl); 
                    map.addControl(new GLargeMapControl()); 
                    var marker = new GMarker(point); 
                      map.addOverlay( new GMarker ( point, {draggable: true} ) ); 
                    var _scope=scope.contador++; 
                      GEvent.addListener(marker, "click", function() {(function(c){ 
                          marker.openInfoWindowHtml(htm[c]);})(_scope);   
                      })         
                } 
          } 
        );   
      } 
}     
    </script> 
    <style>body{margin:0}</style>   
  </head> 
  <body onload="initialize()" onunload="GUnload()"> 
    <div id="map_canvas" style="width: 300px; height: 250px"></div> 
  </body> 
</html>           |