1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
echo "<script>
function load() {
var map;
var directionsPanel;
var directions;
map = new GMap2(document.getElementById(\"map_canvas\"));
map.addControl(new GLargeMapControl3D());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(47.082999, 2.395692), 6);
directionsPanel = document.getElementById(\"map_directions\");
directions = new GDirections(map, directionsPanel);
directions.load(\"from: \"".$latA."\",\"".$longA."\" to: \"".$latB."\",\"".$longB.");
GEvent.addListener(directions,\"load\", function() {
var distance = directions.getDistance().meters;
var duree = directions.getDuration().seconds;
alert(\"- Distance : \"+distance+\" Metres\n- Durée : \"+duree+\" Secondes\");
});
};
</script>"; |
Partager