Ver Mensaje Individual
  #1 (permalink)  
Antiguo 07/04/2011, 09:07
ginom77
 
Fecha de Ingreso: abril-2011
Mensajes: 14
Antigüedad: 13 años
Puntos: 2
Pregunta imprimir ruta de google maps

Buenas! Estoy realizando mi trabajo de tesis. El sistema que estoy realizando utiliza al api de google maps para marcar las rutas de un recorrido. Y asi poder calcular el combustible a utilizar.
Calculo todo sin problema.
Lo que no estoy sabiendo es como puedo imprimir el mapa que se calculó si se realizó un cambio en forma manual en el mapa.
Sería como el link “imprimir” que se encuentra en la cabecera del mapa en http://maps.google.es/ lo que estoy necesitando.
O si pudiera guardar de alguna forma en mi mysql
Este seria mi código

<?php

$location = "{location: '(-25.285176773048878, -57.621145924072266)'},{location: '(-25.2847499309663, -57.587972362976075)'} ";
?>
<html>
<head>
<title>google mapss</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="shortcut icon" type="image/x-icon" href="images/titulo.png"/>
<script src="js/jquery-1.3.1.min.js" type="text/javascript"></script>
<script src="js/jquery.functions.js" type="text/javascript"></script>

<link href="http://code.google.com/apis/maps/documentation/javascript/examples/standard.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&language=es"></script>
<script type="text/javascript">

var rendererOptions = {
draggable: true
};
var directionsDisplay = new google.maps.DirectionsRenderer(rendererOptions);;
var directionsService = new google.maps.DirectionsService();
var map;


var asuncion = new google.maps.LatLng<?php include"posicion_empresa.txt"; ?>;

function initialize() {

var myOptions = {
zoom: 7,
mapTypeId: google.maps.MapTypeId.ROADMAP,
center: asuncion
};
map = new google.maps.Map(document.getElementById("map_canva s"), myOptions);
directionsDisplay.setMap(map);
directionsDisplay.setPanel(document.getElementById ("directionsPanel"));

google.maps.event.addListener(directionsDisplay, 'directions_changed', function() {
computeTotalDistance(directionsDisplay.directions) ;
});



calcRoute();
//flightPath.setMap(map);
}

function calcRoute() {

var request = {
origin: "(-25.26445379695485, -57.552996357421875)",
destination: "(-25.26445379695485, -57.552996357421875)",
waypoints:[<?php echo $location; ?>],
travelMode: google.maps.DirectionsTravelMode.DRIVING
};
directionsService.route(request, function(response, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
}
});
}

function computeTotalDistance(result) {
var total = 0;
var myroute = result.routes[0];
for (i = 0; i < myroute.legs.length; i++)
{
total += myroute.legs[i].distance.value;
}
total = total / 1000.
//document.getElementById("total").innerHTML = total + " km";
//document.getElementById('km').value = total;

}

function cerrarVentana(){
var ventana = window.self;
ventana.opener = window.self;
ventana.close();
}
</script>


</head>
<body onLoad="initialize()">



<div id="map_canvas" style="float:right;width:70%; height:100%"></div>
<div id="directionsPanel" style="float:left;width:30%;height:100%;overflow:a uto">

<p> <span id="total"></span></p>
</div>
</div>



</body>
</html>