2016-12-01 14 views
0

マーカーの周りに正方形を描きたい。大きな正方形を描くと、地図が自動的に縮小され、正方形が完全に見えるようになります。小さな正方形を描くと、地図が自動的に拡大されて正方形が完全に表示されます。プログラムで地図をズームする方法Openlayers 3?

In this image i have drawn small square so we can see the square completely

In this image i have drawn a larger square, Since the map is not zooming out we cannot see the square sides

答えて

3

OpenLayersを3ドキュメントでol.Viewを参照してください。機能はsetZoom(zoom)です。だから、

マップ変数が使用map.getView().setZoom(map.getView().getZoom() + 1);にズームインすると、使用map.getView().setZoom(map.getView().getZoom() + 1);

をズームアウトして、 mapある場合
関連する問題