If I dynamically render a polygon (for example the border of a district in the UK) on a map, with OpenLayers 3, is it possible somehow to zoom in on the polygon, until it exactly fits the view?
1 Answer
You can't ever guarantee to exactly fit the view as in general your district may have a different aspect ratio (width/height) than your view.
OpenLayers 3 provides the useful fit
method on the view to allow you to do this.