cdd9b62e80c66cf40283bb84410df869f7602e7b
[lhc/web/spip_carte_de_sites.git] / contenu / page-carte_de_sites.html
1 <div id="map" style="width: 540px; height: 400px"></div>
2
3
4 <h2 class='h2 spip'>Legende</h2>
5 <BOUCLE_legende(MOTS){type = Ateliers}{par num titre}>
6 <p>#LOGO_MOT [(#TITRE|supprimer_numero)]</p>
7 </BOUCLE_legende>
8
9
10
11 <h2 class='h2 spip'>Ateliers</h2>
12 <BOUCLE_liste_pays(GIS){par pays}{fusion pays}>
13 <h3 class='h3 spip'>#PAYS</h3>
14 <BOUCLE_liste_region(GIS){par region}{pays}{fusion region}>
15 <h4 class='h4 spip'>#REGION</h4>
16 <BOUCLE_liste_ateliers(GIS){par ville}{region}>
17 <li>#VILLE (#CODE_POSTAL) #TITRE - #ADRESSE</li>
18 </BOUCLE_liste_ateliers>
19 </BOUCLE_liste_region>
20 </BOUCLE_liste_pays>
21
22 <script src="#CONFIG{adresse_site}/lib/CloudMade-Leaflet-404b097/dist/leaflet.js"></script>
23 <script>
24 var map = new L.Map('map');
25
26 var cloudmadeUrl = 'http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png',
27 cloudmadeAttribution = 'Map data &copy; 2011 OpenStreetMap contributors, Imagery &copy; 2011 CloudMade',
28 cloudmade = new L.TileLayer(cloudmadeUrl, {maxZoom: 18, attribution: cloudmadeAttribution});
29
30 map.setView(new L.LatLng(46.8, 2.52), 5).addLayer(cloudmade);
31
32
33
34 <BOUCLE_ateliers_types(MOTS){type = Ateliers}{par num titre}>
35 <BOUCLE_sites(SITES){id_mot}>
36 <BOUCLE_coord(GIS){id_syndic}>
37 var WorkshopIcon = L.Icon.extend({
38 iconUrl: '#CONFIG{adresse_site}/IMG/[(#LOGO_MOT|fichier)]',
39 shadowUrl: '#CONFIG{adresse_site}/IMG/[(#LOGO_MOT_SURVOL|fichier)]',
40 iconSize: new L.Point(25, 41),
41 shadowSize: new L.Point(41, 41),
42 iconAnchor: new L.Point(13, 41),
43 popupAnchor: new L.Point(0, -33)
44 });
45 siteIcon = new WorkshopIcon()
46 var markerAtelier = new L.Marker(new L.LatLng(#LAT, #LON), {icon: siteIcon});
47 map.addLayer(markerAtelier);
48 markerAtelier.bindPopup("<a href='#URL_SITE'>#NOM_SITE</a><br/>#_sites:DESCRIPTIF<br/>#ADRESSE<br/> #CODE_POSTAL #VILLE<br/><br/><em>Statut: [(#_ateliers_types:TITRE|supprimer_numero)]</em>");
49 </BOUCLE_coord>
50 </BOUCLE_sites>
51 </BOUCLE_ateliers_types>
52
53
54 map.on('click', onMapClick);
55
56 var popup = new L.Popup();
57
58 function onMapClick(e) {
59 var latlngStr = '(' + e.latlng.lat.toFixed(3) + ', ' + e.latlng.lng.toFixed(3) + ')';
60
61 popup.setLatLng(e.latlng);
62 popup.setContent("You clicked the map at " + latlngStr);
63 map.openPopup(popup);
64 }
65
66 </script>