0
我使用下面的代碼爲我的網頁,但我想地圖顯示在this example邊框。
我怎麼弄出來的?谷歌地圖的網頁
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script language="javascript" type="text/javascript">
var map;
var geocoder;
function InitializeMap() {
var latlng = new google.maps.LatLng(39.646859, 27.883121);
var myOptions =
{
zoom: 8,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP,
disableDefaultUI: true
};
map = new google.maps.Map(document.getElementById("map"), myOptions);
}
function FindLocation(whichone) {
geocoder = new google.maps.Geocoder();
InitializeMap();
var control1 = document.getElementById('<%= DDL_Ilce.ClientID %>');
var selectedvalue1 = control1.options[control1.selectedIndex].text;
var control2 = document.getElementById('<%= DDL_Mahalle.ClientID %>');
var selectedvalue2 = control2.options[control2.selectedIndex].text;
if (whichone == 1) {
var address = " Balıkesir" ;
}
else
{
var address = selectedvalue2 + " Balıkesir" ;
}
alert(address);
geocoder.geocode({ 'address': address, 'region':'Turkey' }, function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
map.fitBounds(results[0].geometry.bounds);
var marker = new google.maps.Marker({
map: map,
position: results[0].geometry.location
});
}
else {
alert("Geocode was not successful for the following reason: " + status);
}
});
}
window.onload = InitializeMap;
</script>
GoogleMap會自動顯示多邊形。我希望它顯示在每個地址搜索。 –
您只需更新緯度並登錄搜索。 – W3BGUY
這沒什麼,但我可以在用戶下次訪問後在哪裏獲得新的flightPlanCoordinates。 –