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 28 29 30 31 32 33 34
| (function ($) {
$('#map_sentiers').gmap({
'center': '45.752051,6.295604',
'zoom': 12
}).bind('init', function (ev, map) {
$('#choose_sentiers').change(function () {
var selected = $('#choose_sentiers').val();
$('#map_sentiers').gmap('loadKML', 'sentier', 'http://example.com/kml/sentiers/' + selected + '.kml');
$.getJSON("js/rocher_blanc.geojson", function (data) {
$.each(data["features"], function (key, val) {
var longitude = val["geometry"]["coordinates"][0];
var latitude = val["geometry"]["coordinates"][1];
var nom = val["properties"]["NOM"];
var type = val["properties"]["TYPE"];
$('#map_sentiers').gmap('addMarker', {
'position': new google.maps.LatLng(latitude, longitude)
}).click(function () {
$('#map_sentiers').gmap('openInfoWindow', {
'content': nom
}, this);
});
});
//------------------
// devrait être ICI
//------------------
$('#map_sentiers').gmap('set', 'MarkerClusterer', new MarkerClusterer(map, $(this).gmap('get', 'markers')));
});
});
//------------------
// MAIS PAS ICI
//------------------
// $('#map_sentiers').gmap('set', 'MarkerClusterer', new MarkerClusterer(map, $(this).gmap('get', 'markers')));
});
})(jQuery); |
Partager