2013-09-27 2 views
0

Google지도가 하루 전과 다른 방식으로 작동하는 이유를 정리하려고합니다.Google지도는 매일 다른 위치를 표시합니다.

저는 최근에 고객의 웹 사이트를 온라인에 올렸습니다. 위치 정보 오류가 발생하여이를 수정했습니다. 시험장에서 그걸 고치지 않았어.

오늘 양측 (고정 된 하나의 테스트 중 하나)에서 내 지리적 위치가 아프리카 중심에서 검색된 위치를 표시하기 시작했습니다. 나는 정말로 우둔한 상황에 처해있다. 그것은 다음날 작동하지 않습니다.

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. 

왜 변경 되나요? 지난 번에 변경된 이후로 잘못된 것일 수 있습니다.

답변

2

는 위도와 경도를 섞어 것, 그리고 results[0].geometry.location 이미 LatLng 객체이기 때문에, 당신은 단순히 나를 위해 작동

markerOwn.setPosition(results[0].geometry.location); 

를 사용할 수 있습니다.

+0

방금 ​​전에 풀었던이 질문에 대한 답변이었습니다. 일부 문서를 읽은 후에는 이미 LatLng 개체였습니다. 답변 해 주셔서 감사합니다. – Grzegorz

관련 문제