Ver Mensaje Individual
  #5 (permalink)  
Antiguo 10/06/2011, 12:57
musashi003
 
Fecha de Ingreso: agosto-2006
Mensajes: 9
Antigüedad: 17 años, 8 meses
Puntos: 0
De acuerdo Respuesta: Coordenadas de Google Maps

Muchas gracias por tu ayuda abimaelrc, ya pude hacer que funcione, dejo el codigo aqui como referencia, para alguien mas que lo necesite.

Muchas gracias.

Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  4. <title>Documento sin t&iacute;tulo</title>
  5.  
  6. <script src="http://maps.google.com/maps/api/js?sensor=false">
  7. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js">
  8. <script type="text/javascript">
  9. function geolocalizar()
  10.     {
  11.         $("#status").text("Espera te estamos localizando...");
  12.         navigator.geolocation.getCurrentPosition(mostrarMapa, errorMapa);
  13.     }
  14.    
  15.     function mostrarMapa(posicion)
  16.     {
  17.         var lat = posicion.coords.latitude;
  18.         var lon = posicion.coords.longitude;
  19.         $("#status").text("Te encontramos! Estas en: " + lat + "," + lon);
  20.        
  21.         $("#mapa_canvas").css("height", "300px");
  22.         $("#mapa_canvas").css("width", "400px");
  23.         $("#mapa_canvas").css("margin", "left");
  24.         var coordenada = new google.maps.LatLng(lat,lon);
  25.         var opciones = {
  26.             zoom: 16,
  27.             center: coordenada,
  28.             mapTypeId: google.maps.MapTypeId.ROADMAP
  29.         };
  30.         var mapa = new google.maps.Map(document.getElementById("mapa_canvas"), opciones);
  31.        
  32.         var opcionesChinche = {
  33.             position: coordenada,
  34.             map: mapa,
  35.             title:"Ubicacion del establecimiento",
  36.             draggable: true
  37.         };
  38.        
  39.         var chinche = new google.maps.Marker(opcionesChinche);
  40.         google.maps.event.addListener(chinche, 'drag', function(e){
  41.         document.getElementById('localizar').value=e.latLng;
  42.         });
  43.            
  44.     }
  45.    
  46.    function errorMapa(errorsh)
  47.     {
  48.         $("#status").text("Casi te encontramos, espera...");
  49.     }
  50.    
  51.     $(document).ready(
  52.       function ()
  53.         {
  54.             geolocalizar();
  55.            
  56.         }
  57.     );
  58.  
  59.  
  60. </head>
  61.  
  62. <input type="text" id="localizar" style="width:10;" />
  63. <p id="status"></p>
  64. <div id="mapa_canvas"></div>
  65.  
  66. </body>
  67. </html>
[URL="http://dl.dropbox.com/u/15574377/index.html"]Ver mapa en funcionamiento[/URL]


Un saludo.

Última edición por musashi003; 10/06/2011 a las 13:02