1 <BOUCLE_gis(GIS){objet ?}{id_objet ?}{id_gis ?}{
0,
1}
>
2 <div id=
"map_preview" class=
"carte_gis" style=
"width: 100%; height: 150px;"></div>
4 <script type=
"text/javascript">
7 var init_map_preview = function() {
9 var map_preview_container = 'map_preview';
12 map_preview = new L.Map(map_preview_container);
14 map_preview.attributionControl.setPrefix('');
16 var base_layer = [new (#EVAL{$GLOBALS\['gis_layers'\]}|table_valeur{[(#REM|gis_layer_defaut)]/layer})];
17 map_preview.addLayer(base_layer);
19 map_preview.setView(new L.LatLng([(#LAT)],[(#LON)]),[(#ZOOM|sinon{#CONFIG{gis/zoom,
0}})]);
21 [(#REM) On ajoute les points ou le point unique suivant les params ]
24 "type":
"FeatureCollection",
26 <BOUCLE_points(GIS){id_objet}{objet}{
","}
>
28 "geometry": {
"type":
"Point",
"coordinates": [#LON, #LAT]},
31 "title":[(#TITRE|supprimer_numero|json_encode)],
32 "description":[(#DESCRIPTIF|json_encode)][
33 (#LOGO_GIS|gis_icon_properties)]
39 [(#TOTAL_BOUCLE|
>{
1}|oui) #SET{autocenter,oui} ]
41 <BOUCLE_point(GIS){id_gis}
>
43 "type":
"FeatureCollection",
46 "geometry": {
"type":
"Point",
"coordinates": [#LON, #LAT]},
49 "title":[(#TITRE|supprimer_numero|json_encode)],
50 "description":[(#DESCRIPTIF|json_encode)][
51 (#LOGO_GIS|gis_icon_properties)]
58 var geojson = new L.geoJson('', {
59 onEachFeature: function (feature, layer) {
60 if (feature.properties && feature.properties.icon){
61 layer.setIcon(new L.Icon({
62 iconUrl: feature.properties.icon,
63 iconSize: new L.Point( feature.properties.icon_size\[
0\], feature.properties.icon_size\[
1\] ),
64 iconAnchor: new L.Point( feature.properties.icon_anchor\[
0\], feature.properties.icon_anchor\[
1\] ),
65 popupAnchor: new L.Point( feature.properties.popup_anchor\[
0\], feature.properties.popup_anchor\[
1\] )
68 if (feature.properties && feature.properties.title){
69 var popupContent = '
<strong>' + feature.properties.title + '
</strong>';
70 if (feature.properties.description)
71 popupContent = popupContent + feature.properties.description;
72 layer.bindPopup(popupContent);
75 }).addTo(map_preview);
76 geojson.addData(data);
77 [(#GET{autocenter}|oui)
78 if(data.features.length
> 1)
79 map_preview.fitBounds(geojson.getBounds());]
81 [(#REM) On ajoute les KML attachés à l'objet ]
82 <BOUCLE_kml(DOCUMENTS){tous}{objet}{id_objet}{extension=kml}
>
83 map_preview.addLayer(new L.KML('[(#URL_DOCUMENT|url_absolue)]', {async: true}));
85 [(#REM) On ajoute les GPX attachés à l'objet ]
86 <BOUCLE_gpx(DOCUMENTS){tous}{objet}{id_objet}{extension=gpx}
>
87 map_preview.addLayer(new L.GPX('[(#URL_DOCUMENT|url_absolue)]', {async: true}));
92 jQuery.getScript('[(#PRODUIRE{fond=javascript/gis.js}|compacte)]',function(){
95 //onAjaxLoad(init_map_preview(true));