पर फ़ंक्शन नहीं कर रहा है मेरे पास मार्कर क्लास्टर लाइब्रेरी को मेरे Google मानचित्र के लिए काम करने का प्रयास करने के लिए निम्न कोड है लेकिन किसी कारण से यह कुछ भी नहीं बदलता है। मेरे पास लूप के लिए कुछ जिन्जा 2 है लेकिन यह सब ठीक से काम कर रहा है। क्या आप कोई त्रुटि देख सकते हैं?Google मानचित्र मार्कर क्लस्टरर
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
#map_canvas { height: 100% }
</style>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key=AIzaSyD-pLsocZXv5mYwJsSxMghJncxa6iklFUU&sensor=false"></script>
<script type="text/javascript" src="/static/js/markerclusterer.js"></script>
<script type="text/javascript">
var map;
function initialize() {
var centerlocation = {{centerlocation|json_encode|safe}};
var LatLng = centerlocation.replace("(", "").replace(")", "").split(", ")
var Lat = parseFloat(LatLng[0]);
var Lng = parseFloat(LatLng[1]);
var zoomAmt = 10;
var USA = new google.maps.LatLng(Lat, Lng);
var mapOptions = {
zoom: zoomAmt,
center: USA,
mapTypeId: google.maps.MapTypeId.TERRAIN
};
map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
// Global var
var infowindow = new google.maps.InfoWindow();
//markers array
var markers = [];
//put all the markers on the map
{% for location in locations %}
//need to do the JSON encoding because JavaScript can't have Jinja2 variables
//I need the safe here because Jinja2 tries to escape the characters otherwise
var GPSlocation = {{location.GPSlocation|json_encode|safe}};
var LatLng = GPSlocation.replace("(", "").replace(")", "").split(", ")
var Lat = parseFloat(LatLng[0]);
var Lng = parseFloat(LatLng[1]);
var markerLatlng = new google.maps.LatLng(Lat, Lng);
var title = {{location.title|json_encode|safe}}
var iwContent = {{location.render_front()|json_encode|safe}}
var marker = new google.maps.Marker({
position: markerLatlng,
title: title,
map: map
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.setContent(iwContent);
infowindow.open(map, marker);
});
//putting the marker onto the markers array
markers.push(marker);
{% endfor %}
//creating the marker cluster
var markerCluster = new MarkerClusterer(map, markers);
}
</script>
जैसा कि मैंने कहा था कि मार्कर क्लस्टरर को कॉल करने के बाद मानचित्र सामान्य दिखता है।
यदि आप मानचित्र ज़ूम करते हैं तो यह क्लस्टर करता है? क्लस्टरिंग के साथ यहां एक [कामकाजी उदाहरण] (http://www.geocodezip.com/v3_MW_example_map3_clustered.html) है। – geocodezip