3

질문이 있습니다. 나는 오픈 층의 실제 줌 내가 map.getZoom()으로 시도현재 오픈 레이어를 확대하는 방법

$scope.refreshMap = function (lat, long) { 
    map.setView(new ol.View({ 
     projection: 'EPSG:4326', 
     center: [long, lat], 
     zoom: "here I do not know what to put" 
    })); 
}; 

지도 알 필요가 있지만 작동하지 않습니다. 로그 캣 내가 openlayers 버전을 사용하고 나에게

Uncaught TypeError: Object #<S> has no method 'getZoom' 

를 던졌습니다 : v3.16.0

답변

8

ol.View의 속성입니다. 따라서 ol.Map에는 확대/축소 수준, 중심, 투영법이있는 ol.View이 있습니다.

map.getView().getZoom(); 
+0

가 !!!!!!!!! 작동 –

+0

고마워요 @ 요나타 워커 –

+0

@IvanParedes. –

0
$scope.refreshMap = function (lat, long) { 
      var actualZoom = map.getView().getZoom(); 
      console.log(z); 

      map.setView(new ol.View({ 
       projection: 'EPSG:4326', 
       center: [long, lat], //long,lat 
       zoom: actualZoom 
      })); 
}; 
관련 문제