问题
i have a fusion table that changes very often.
And i have a javascript code that allows to visualize location information from database.
But how can i reload map without reloading whole page.
This is my code:
function initialize() {
map = new google.maps.Map(document.getElementById('map_canvas'), {
center: new google.maps.LatLng(60,30),
zoom: 9,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
layer = new google.maps.FusionTablesLayer({
query: {
select: 'location',
from: '3415835'
}
});
layer.setMap(map);
}
I've already tried this:
function initialize() {
//var chicago = new google.maps.LatLng(60, 40);
map = new google.maps.Map(document.getElementById('map_canvas'), {
center: new google.maps.LatLng(60,30),
zoom: 9,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
layer = new google.maps.FusionTablesLayer({
query: {
select: 'location',
from: '3415835'
}
});
layer.setMap(map);
refreshMap();
}
function refreshMap(){
layer.setOptions({
query: {
select: 'location',
from: '3415835'
}
});
setTimeout('refreshMap()',5000);
}
this one didn't worked.
回答1:
Have you tried throwing in a layer.setMap(null);
in the mix, and then resetting it?
来源:https://stackoverflow.com/questions/9994764/how-to-correctly-reload-fusion-tables-layer