1 |
aurelien |
1 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
|
|
2 |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
|
3 |
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
|
4 |
<head>
|
|
|
5 |
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
|
|
|
6 |
<title>Google Maps JavaScript API Example</title>
|
|
|
7 |
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAnm2MSMmwsDuoh7THcVDnlBSAZKnAlQZLiLpbAbKDMtId8LKOVBT1EbOX0DTIKvay9z_AquSgc2_r9A"
|
|
|
8 |
type="text/javascript"></script>
|
|
|
9 |
<script type="text/javascript">
|
|
|
10 |
|
|
|
11 |
//<![CDATA[
|
|
|
12 |
var latFr = 47;
|
|
|
13 |
var lonFr = 1.7;
|
|
|
14 |
|
|
|
15 |
var latFrMin = 34;
|
|
|
16 |
var latFrMax = 58;
|
|
|
17 |
var lonFrMin = -12;
|
|
|
18 |
var lonFrMax = 15;
|
|
|
19 |
|
|
|
20 |
function load() {
|
|
|
21 |
if (GBrowserIsCompatible()) {
|
|
|
22 |
var map = new GMap2(document.getElementById("map"));
|
|
|
23 |
map.setCenter(new GLatLng(latFr, lonFr), 6);
|
|
|
24 |
map.addControl(new GSmallMapControl());
|
|
|
25 |
map.addControl(new GMapTypeControl());
|
|
|
26 |
map.setMapType(GMapType.G_SATELLITE_MAP);
|
|
|
27 |
//map.addControl(new GSmallZoomControl());
|
|
|
28 |
// window.setTimeout(function() {
|
|
|
29 |
GEvent.addListener(map, "moveend", function() {
|
|
|
30 |
var bounds = map.getBounds();
|
|
|
31 |
var southWest = bounds.getSouthWest();
|
|
|
32 |
var northEast = bounds.getNorthEast();
|
|
|
33 |
if (southWest.lng()<lonFrMin || southWest.lat()<latFrMin
|
|
|
34 |
|| northEast.lng()>lonFrMax || northEast.lat()>latFrMax)
|
|
|
35 |
map.returnToSavedPosition();
|
|
|
36 |
else
|
|
|
37 |
map.savePosition();
|
|
|
38 |
}, 20);
|
|
|
39 |
|
|
|
40 |
// Creates a marker at the given point with the given number label
|
|
|
41 |
function createMarker(point, number) {
|
|
|
42 |
var marker = new GMarker(point);
|
|
|
43 |
GEvent.addListener(marker, "click", function() {
|
|
|
44 |
marker.openInfoWindowHtml("Coordonnées : <b>" + number + "</b>");
|
|
|
45 |
});
|
|
|
46 |
return marker;
|
|
|
47 |
}
|
|
|
48 |
<?
|
|
|
49 |
include("traitement.php");
|
|
|
50 |
?>
|
|
|
51 |
//On définit les puces
|
|
|
52 |
//var icons = new Array();
|
|
|
53 |
<? for ($i=0; $i<=$nbPuces; $i++) { ?>
|
|
|
54 |
var icon<?= $i ?> = new GIcon();
|
|
|
55 |
icon<?= $i ?>.image = "puces/<?= $i ?>.gif";
|
|
|
56 |
icon<?= $i ?>.shadow = "puces/ombre.png";
|
|
|
57 |
icon<?= $i ?>.iconSize = new GSize(14,14);
|
|
|
58 |
icon<?= $i ?>.shadowSize = new GSize(20,20);
|
|
|
59 |
icon<?= $i ?>.iconAnchor = new GPoint (6,20);
|
|
|
60 |
icon<?= $i ?>.inconWindowAnchor = new GPoint(5,1);
|
|
|
61 |
<? } ?>
|
|
|
62 |
//alert(icons[0].image);
|
|
|
63 |
//on va poser les points des villes
|
|
|
64 |
<?
|
|
|
65 |
include ("../modules/connect.php");
|
|
|
66 |
$req_communes = mysql_query("SELECT DISTINCT STATION_LATITUDE, STATION_LONGITUDE, STATION_ID FROM STATION");
|
|
|
67 |
while ($commune = mysql_fetch_row($req_communes)) {
|
|
|
68 |
if (is_numeric($dates[$commune[2]])) {
|
|
|
69 |
?>
|
|
|
70 |
var point = new GLatLng(<?= $commune[0] ?>, <?= $commune[1] ?>);
|
|
|
71 |
map.addOverlay(new GMarker(point, icon<?= $dates[$commune[2]] ?>));
|
|
|
72 |
<? } } ?>
|
|
|
73 |
}
|
|
|
74 |
}
|
|
|
75 |
|
|
|
76 |
//]]>
|
|
|
77 |
</script>
|
|
|
78 |
</head>
|
|
|
79 |
<body onload="load()" onunload="GUnload()">
|
|
|
80 |
<div id="map" style="width: 600px; height: 600px"></div>
|
|
|
81 |
</body>
|
|
|
82 |
</html>
|