javascript

Fractional zoom (smooth zoom) in OL3  #angularjs #reactjs

  • OpenLayers 3 works the opposite way: it supports any fractional zoom level out of the box, but its controls and interactions constrain the zoom they set to integer zoom levels.
  • Stack Overflow works best with JavaScript enabled
  • Update: Recent OpenLayers versions (v3.20.0 and above) do not restrict zoom levels any more when using wheel or pinch zoom.
  • This also means that you can create custom controls and interactions that do not constrain the zoom level to integers.
  • sign up log in tour help

I want to upgrade my Web-Mapping-Application from OL2 to OL3 and now I was stopped by a problem of smooth zooming. In the OL2 I used the map.fractionalZoom feature, because my app uses a single Tile WMS and it’s necessary for me to zoom exactly to any scale by using a slider or a ZoomBox (DragZoom in OL3).

@ng_real_ninja: Fractional zoom (smooth zoom) in OL3 #angularjs #reactjs

feature, because my app uses a single Tile WMS and it’s necessary for me to zoom exactly to any scale by using a slider or a ZoomBox (DragZoom in OL3).

OpenLayers 3 works the opposite way: it supports any fractional zoom level out of the box, but its controls and interactions constrain the zoom they set to integer zoom levels. This means that you can set a fractional zoom level programmatically:

This also means that you can create custom controls and interactions that do not constrain the zoom level to integers. If, for example, you want to fit the view to an exact extent you created using

, your custom zoom box interaction could look like this:

Update: Recent OpenLayers versions (v3.20.0 and above) do not restrict zoom levels any more when using wheel or pinch zoom.

javascript

You might also like More from author

Comments are closed, but trackbacks and pingbacks are open.