-1
Ниже приведен мой код. Карта загружается один раз, но после этого не обновляется запрос слояFusion Table Фильтры не в состоянии обновить карту
Пожалуйста, если кто-то может предоставить мне решение в ближайшее время карта по умолчанию загружается всегда, как только опция также выбрана, и это Главная проблема. Карта в соответствии с фильтрами не производится.
<!DOCTYPE html>
<html>
<head>
<meta name="viewport"></meta>
<title>Rise Project (Responses) - Google Fusion Tables</title>
<style type="text/css">
html, body, #googft-mapCanvas {
height: 800px;
margin: 0;
padding: 0;
width: 600px;
}
</style>
<script type="text/javascript" src="https://maps.google.com/maps/api/js?v=3"></script>
<script type="text/javascript">
//var tableId = '1hVh2fZH52W9qCM4rMnqzjG6z3lPM5B970H__hLUn';
function initialize() {
var tableId = '1hVh2fZH52W9qCM4rMnqzjG6z3lPM5B970H__hLUn';
google.maps.visualRefresh = true;
var isMobile = (navigator.userAgent.toLowerCase().indexOf('android') > -1) ||
(navigator.userAgent.match(/(iPod|iPhone|iPad|BlackBerry|Windows Phone|iemobile)/));
if (isMobile) {
var viewport = document.querySelector("meta[name=viewport]");
viewport.setAttribute('content', 'initial-scale=1.0, user-scalable=no');
}
var mapDiv = document.getElementById('googft-mapCanvas');
mapDiv.style.width = isMobile ? '100%' : '600px';
mapDiv.style.height = isMobile ? '100%' : '600px';
var map = new google.maps.Map(mapDiv, {
center: new google.maps.LatLng(30.3765560012846, 77.97422298410743),
zoom: 13,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
map.controls[google.maps.ControlPosition.RIGHT_BOTTOM].push(document.getElementById('googft-legend-open'));
map.controls[google.maps.ControlPosition.RIGHT_BOTTOM].push(document.getElementById('googft-legend'));
layer = new google.maps.FusionTablesLayer({
map: map,
heatmap: { enabled: false },
query: {
select: "*",
from: tableId
},
options: {
styleId: 2,
templateId: 3
}
});
window.alert(layer.query.where);
if (isMobile) {
var legend = document.getElementById('googft-legend');
var legendOpenButton = document.getElementById('googft-legend-open');
var legendCloseButton = document.getElementById('googft-legend-close');
legend.style.display = 'none';
legendOpenButton.style.display = 'block';
legendCloseButton.style.display = 'block';
legendOpenButton.onclick = function() {
legend.style.display = 'block';
legendOpenButton.style.display = 'none';
}
legendCloseButton.onclick = function() {
legend.style.display = 'none';
legendOpenButton.style.display = 'block';
}
}
window.alert("BEfore");
google.maps.event.addDomListener(document.getElementById('delivery'),
'change', function() {
updateMap(layer, tableId);
});
}
function updateMap(layer, tableId) {
var delivery = document.getElementById('delivery').value;
window.alert(delivery + "In Update Map");
if (delivery) {
layer.setOptions({
query: {
select: "*",
from: tableId,
where: "Boys/Girls = '" + delivery + "'"
}
});
} else {
layer.setOptions({
query: {
select: "*",
from: tableId
}
});
}
}
window.alert("Out of function");
google.maps.event.addDomListener(window, 'load', initialize);
window.alert("End");
</script>
</head>
<body>
<br><br><br><p align="center">
<div id="googft-mapCanvas">
</div>
<label>Boys/Girls?</label>
<select id="delivery">
<option value="">--Select--</option>
<option value="Boys">Boys</option>
<option value="Girls">Girls</option>
</select></p>
</body>
</html>