Ver Mensaje Individual
  #9 (permalink)  
Antiguo 01/08/2012, 14:26
Avatar de Bullet
Bullet
 
Fecha de Ingreso: agosto-2005
Ubicación: Margarita, Venezuela
Mensajes: 235
Antigüedad: 18 años, 9 meses
Puntos: 1
Respuesta: Mostrar mapa de rutas haciendo clic en un link

Que tal amigo, el codigo de esa linea es el siguiente:

Código PHP:
$xmlStr=str_replace("'",'',$xmlStr); 
Me supongo que cuando pase el codigo fuente para aca, se cambio por las 3 comillas, ojo no me di cuenta, incluso revise los scripts que hice y estan con el "'"(esto va donde estan las 3 comillas, nose porque carajo hace la conversion)

Quiero volver a lo primero que intente, que ingresando el codigo o nuero del viaje, se me muestre el mapa directo con las posiciones, sin ver la tabla, pero solo me carga el archivo xml, el mapa lo carga vacio.. el codigo que uso para cargar el mapa es el siguiente:

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">
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>Google Maps AJAX + MySQL/PHP Example</title>
    <script src="https://maps.google.com/maps?file=api&v=2&key=ABQIAAAAjU0EJWnWPMv7oQ-jjS7dYxTPZYElJSBeBUeMSX5xXgq6lLjHthSAk20WnZ_iuuzhMt60X_ukms-AUg"
            type="text/javascript"></script>

    <script type="text/javascript">
    //<![CDATA[
	
	var iconder = new GIcon(); //DERIVA
    iconder.image = 'deriva.png';
    iconder.iconSize = new GSize(28, 32);
    iconder.shadowSize = new GSize(28, 32);
    iconder.iconAnchor = new GPoint(30, 20);
    iconder.infoWindowAnchor = new GPoint(5, 1);

    var iconBlue = new GIcon(); //NAVEGAR
    iconBlue.image = 'nav.png';
    iconBlue.iconSize = new GSize(28, 32);
    iconBlue.shadowSize = new GSize(28, 32);
    iconBlue.iconAnchor = new GPoint(30, 20);
    iconBlue.infoWindowAnchor = new GPoint(5, 1);
	
	var iconil = new GIcon(); //INILAN
    iconil.image = 'inil.png';
    iconil.iconSize = new GSize(36, 32);
    iconil.shadowSize = new GSize(28, 32);
    iconil.iconAnchor = new GPoint(6, 20);
    iconil.infoWindowAnchor = new GPoint(5, 1);
	
	var iconfl = new GIcon(); //FINLAN
    iconfl.image = 'finl.png';
    iconfl.iconSize = new GSize(36, 32);
    iconfl.shadowSize = new GSize(28, 32);
    iconfl.iconAnchor = new GPoint(30, 20);
    iconfl.infoWindowAnchor = new GPoint(5, 1);
	
	var iconir = new GIcon(); //INIREC
    iconir.image = 'inir.png';
    iconir.iconSize = new GSize(36, 32);
    iconir.shadowSize = new GSize(28, 32);
    iconir.iconAnchor = new GPoint(6, 20);
    iconir.infoWindowAnchor = new GPoint(5, 1);
	
	var iconfr = new GIcon(); //FINREC
    iconfr.image = 'finr.png';
    iconfr.iconSize = new GSize(36, 32);
    iconfr.shadowSize = new GSize(28, 32);
    iconfr.iconAnchor = new GPoint(30, 20);
    iconfr.infoWindowAnchor = new GPoint(5, 1);
	
	
	var iconmaf = new GIcon(); //MAMIF
    iconmaf.image = 'mamif.png';
    iconmaf.iconSize = new GSize(28, 32);
    iconmaf.shadowSize = new GSize(28, 32);
    iconmaf.iconAnchor = new GPoint(6, 20);
    iconmaf.infoWindowAnchor = new GPoint(5, 1);

    var iconRed = new GIcon(); //LLEGADA
    iconRed.image = 'llegada.png';
    iconRed.iconSize = new GSize(28, 32);
    iconRed.shadowSize = new GSize(22, 20);
    iconRed.iconAnchor = new GPoint(6, 20);
    iconRed.infoWindowAnchor = new GPoint(5, 1);
	
	var iconsal = new GIcon(); //SALIDA
    iconsal.image = 'salida.png';
    iconsal.iconSize = new GSize(28, 32);
    iconsal.shadowSize = new GSize(22, 20);
    iconsal.iconAnchor = new GPoint(6, 20);
    iconsal.infoWindowAnchor = new GPoint(5, 1);
	
	var icontort = new GIcon(); //TORTUGA
    icontort.image = 'tortuga.png';
    icontort.iconSize = new GSize(28, 32);
    icontort.shadowSize = new GSize(22, 20);
    icontort.iconAnchor = new GPoint(6, 20);
    icontort.infoWindowAnchor = new GPoint(5, 1);
	

   var customIcons = [];
    customIcons[3] = iconder; //mamif
	customIcons[4] = iconmaf; //mamif
    customIcons[8] = iconBlue;//nav
	customIcons[14] = iconsal;//salida
	customIcons[15] = iconRed;//llegada
	customIcons[17] = icontort;//llegada
	customIcons[23] = iconil;//inilan
	customIcons[24] = iconir;//inirec
	customIcons[25] = iconfl;//finlan
	customIcons[26] = iconfr;//finrec
	
    
	
    function load() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map"));
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());
        map.setCenter(new GLatLng(10.466666666666667, -64.18333333333334), 13);

        GDownloadUrl("phpsqlajax_genxml2.php", function(data) {
          var xml = GXml.parse(data);
          var markers = xml.documentElement.getElementsByTagName("marker");
          for (var i = 0; i < markers.length; i++) {
            var name = markers[i].getAttribute("crno");
            var address = markers[i].getAttribute("fecha");
            var type = markers[i].getAttribute("even");
            var point = new GLatLng(parseFloat(markers[i].getAttribute("lat")),
                                    parseFloat(markers[i].getAttribute("long")));
            var marker = createMarker(point, name, address, type);
            map.addOverlay(marker);
          }
        });
      }
    }

    function createMarker(point, name, address, type) {
      var marker = new GMarker(point, customIcons[type]);
      var html = "<b>" + name + "</b> <br/>" + address + "  " + type + "</br> " + point;
      GEvent.addListener(marker, 'click', function() {
        marker.openInfoWindowHtml(html);
      });
      return marker;
    }
    //]]>
  </script>

<style type="text/css">
  #apDiv1 {
	position:absolute;
	left:1219px;
	top:14px;
	width:182px;
	height:603px;
	z-index:1;
}
  </style>
  </head>

  <body onload="load()" onunload="GUnload()">
    <div id="apDiv1">
      <p>EVENTOS/SUCESOS:</p>
      <p><img src="deriva.png" alt="" width="32" height="37" />DERIVA</p>
      <p><img src="mamif.png" alt="" width="32" height="37" />MAMIF</p>
<p><img src="nav.png" alt="" width="32" height="37" />NAV</p>
<p><img src="salida.png" alt="" width="32" height="37" />SALIDA</p>
<p><img src="llegada.png" alt="" width="32" height="37" />LLEGADA</p>
<p><img src="tortuga.png" alt="" width="32" height="37" />TORTUGA</p>
<p><img src="inil.png" alt="" width="32" height="37" />INILAN</p>
<p><img src="finl.png" alt="" width="32" height="37" />FINLAN</p>
<p><img src="inir.png" alt="" width="32" height="37" />INIREC</p>
<p><img src="finr.png" alt="" width="32" height="37" />FINREC</p>
    </div>
    <div id="map" style="width: 1200px; height: 640px"></div>
</body>
</html> 
PD: Amigo una pregunta, no hay forma de meter un enlace en el archivo que me genera el XML? porque asi verifico dicho archivo y luego llamo al mapa, y resuelto el problema...

Última edición por Bullet; 01/08/2012 a las 14:38