0
我試圖理清谷歌地圖爲什麼比前一天表現不同。谷歌地圖每天顯示不同的位置
我最近把我的客戶的網站在線。地理位置出錯了,我修正了它。沒有在測試網站上修復它。
今天,在雙方(固定和測試)我的地理位置開始顯示在非洲中心搜索的位置。我真的無能爲力。它工作,第二天它沒有。
不是說它也停止顯示YellowPin,爲什麼?
var map;
var mapOptions;
var markerOwn = null;
function searchLocations()
{
var address = document.getElementById('addressInput').value;
var geocoder = new google.maps.Geocoder();
geocoder.geocode({address: address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK){
if(markerOwn === null){
markerOwn = new google.maps.Marker({
map: map,
position: new google.maps.LatLng(50, 20),
customInfo: "<br><center><b>Jesteś Tutaj!</b></center>",
flat: false,
icon: 'https://maps.gstatic.com/mapfiles/ms2/micons/ylw-pushpin.png', // user :)
title: "Twoja lokacja",
});
addInfoWindow(markerOwn);
}
markerOwn.setPosition(new google.maps.LatLng(results[0].geometry.location.ob, results[0].geometry.location.pb));
google.maps.event.trigger(markerOwn,'click');
map.panTo(results[0].geometry.location);
}
});
}
您可以在這裏的行動看代碼:http://spafoodbistro.pl/index.php?page=gdzie-jestesmy
編輯: 我早改在
markerOwn.setPosition(new google.maps.LatLng(results[0].geometry.location.ob, results[0].geometry.location.pb));
前,我用不同的值來獲取座標,現在我使用:
results[0].geometry.location.ob to get it.
爲什麼它的變化?也許這是最後一次改變以來的錯誤?
就解決了這個問題前一段時間,正要回答這個問題。在閱讀了一些文檔後,我發現它已經是一個LatLng對象。謝謝你的回答! – Grzegorz