我的HTML代码的一部分
var marker;
function initMap() {
map = new google.maps.Map(document.getElementById("mymap"), myOptions);
getMapMetadata([]);
// setInterval(function(){ getMapMetadata([]); }, 3000);
}
function createMarker(latlng, label, html) {
// alert("createMarker("+latlng+","+label+","+html+","+color+")");
var contentString = '<b>' + label + '</b><br>' + html;
var image;
image = 'static/img/30.png';
var marker = new google.maps.Marker({
position: latlng,
map: map,
icon: image,
title: label,
zIndex: Math.round(latlng.lat() * -100000) << 5
});
marker.myname = label;
google.maps.event.addListener(marker, 'click', function() {
infowindow.setContent(contentString);
infowindow.open(map, marker);
});
return marker;
}
function getMapMetadata(ids) {
$.get("{% url 'app01:cate' %}", { ids: [] }, function(data, status) {
console.log("Data: " + JSON.stringify(data) + "\nStatus: " + status);
var metadata;
var i;
//for(var i=0; i<data.length; i++)
metadata = JSON.parse(JSON.stringify(data));
for (i = 0; i < metadata.length; i++) {
console.log("item: " + metadata[i].x);
marker = createMarker(new google.maps.LatL ng(metadata[i].x, metadata[i].y), metadata[i].id + "", JSON.stringify(metadata[i]));
观点的一部分
uavs = [Map.objects.get(pk=str(i)) for i in range(1, NUAVs+1)]
我想将包含2点值变化的变量添加到模板中的标记