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 = [(#ENV{layer_defaut}|=={none}|?{
"'none'",[new (#EVAL{$GLOBALS\['gis_layers'\]}|table_valeur{[(#ENV{layer_defaut,[(#REM|gis_layer_defaut)]})]/layer})]})];
17 if(base_layer != 'none'){
18 map_preview.addLayer(base_layer);
21 map_preview.setView(new L.LatLng([(#LAT)],[(#LON)]),[(#ZOOM|sinon{#CONFIG{gis/zoom,
0}})]);
23 [(#REM) On ajoute les points ou le point unique suivant les params ]
26 "type":
"FeatureCollection",
28 <BOUCLE_points(GIS){id_objet}{objet}{
","}
>
30 "geometry": {
"type":
"Point",
"coordinates": [#LON, #LAT]},
33 "title":[(#TITRE|supprimer_numero|json_encode)],
34 "description":[(#DESCRIPTIF|json_encode)][
35 (#LOGO_GIS|gis_icon_properties)]
41 [(#TOTAL_BOUCLE|
>{
1}|oui) #SET{autocenter,oui} ]
43 <BOUCLE_point(GIS){id_gis}
>
45 "type":
"FeatureCollection",
48 "geometry": {
"type":
"Point",
"coordinates": [#LON, #LAT]},
51 "title":[(#TITRE|supprimer_numero|json_encode)],
52 "description":[(#DESCRIPTIF|json_encode)][
53 (#LOGO_GIS|gis_icon_properties)]
60 var geojson = new L.geoJson('', {
61 onEachFeature: function (feature, layer) {
62 if (feature.properties && feature.properties.icon){
63 layer.setIcon(new L.Icon({
64 iconUrl: feature.properties.icon,
65 iconSize: new L.Point( feature.properties.icon_size\[
0\], feature.properties.icon_size\[
1\] ),
66 iconAnchor: new L.Point( feature.properties.icon_anchor\[
0\], feature.properties.icon_anchor\[
1\] ),
67 popupAnchor: new L.Point( feature.properties.popup_anchor\[
0\], feature.properties.popup_anchor\[
1\] )
70 if (feature.properties && feature.properties.title){
71 var popupContent = '
<strong>' + feature.properties.title + '
</strong>';
72 if (feature.properties.description)
73 popupContent = popupContent + feature.properties.description;
74 layer.bindPopup(popupContent);
77 }).addTo(map_preview);
78 geojson.addData(data);
79 [(#GET{autocenter}|oui)
80 if(data.features.length
> 1)
81 map_preview.fitBounds(geojson.getBounds());]
83 [(#REM) On ajoute les KML attachés à l'objet ]
84 <BOUCLE_kml(DOCUMENTS){tous}{objet}{id_objet}{extension=kml}
>
85 map_preview.addLayer(new L.KML('[(#URL_DOCUMENT|url_absolue)]', {async: true}));
87 [(#REM) On ajoute les GPX attachés à l'objet ]
88 <BOUCLE_gpx(DOCUMENTS){tous}{objet}{id_objet}{extension=gpx}
>
89 map_preview.addLayer(new L.GPX('[(#URL_DOCUMENT|url_absolue)]', {async: true}));
94 jQuery.getScript('[(#PRODUIRE{fond=javascript/gis.js}|compacte)]',function(){
97 //onAjaxLoad(init_map_preview(true));