當用戶 從下拉菜單中選擇主地圖中的一個地區時,我正嘗試讓我的地圖重新定位到新中心。查看 map here:http://bilware.net/BullyMap/BullyMap.html我的setCenter怎麼不起作用?
我可以使用map.setZoom獲取縮放比例(儘管它的 註釋如下)。但是map.setCenter不起作用。我以爲這是 ,因爲我沒有正確調用LatLng參數,但發現 即使插入固定參數也不行,因爲我認爲我已經完成了 以下。
我對此很新,任何幫助表示讚賞。
function changeMap() {
var selected_bully_table = $('#map_menu').val();
var searchString = document.getElementById('searchString').value.replace("'", "\\'");
if(searchString == "") {
layer.setQuery("SELECT 'geometry' FROM " + selected_bully_table);
return;
}
layer.setQuery("SELECT 'geometry' FROM " + selected_bully_table + " WHERE 'SDNAME' = '" + searchString + "'");
// Now zoom and center the map
{
map.setZoom(9);
myLatLng=(-91.9240850749,47.9119132072);
map.setCenter(myLatLng);
}
}
當我這樣做時,它會返回灰色屏幕。 – Bilware 2011-04-23 23:13:14