Ol Zoom To Extent

Ol Zoom To Extent



A button control which, when pressed, changes the map view to a specific extent. To style this control use the css selector .ol-zoom-extent . new ZoomToExtent ( opt_options ), ol . Extent | undefined: The extent to zoom to. If undefined the validity extent of the view projection is used. Fires: propertychange ( ol .ObjectEvent) – Triggered when a property is changed. Extends. ol .control.Control; Methods. changed inherited experimental. src/ ol /observable.js, line 52 …

Introducing ol .Overlay with a static example 8.6. Using ol .Overlay dynamically with layers information 8.7. Using ol .interaction.Draw to share new information on the Web 8.8. Using ol.

OpenLayers 2 had a very useful map.zoomToExtent( extent ) feature. Is there something similar in OpenLayers 3? I can get the extent of interest with source.getExtent(), but I can’t figure out how to apply that extent as a zoom level.

var zoomToExtentControl = new ol .control.ZoomToExtent({ extent : [-11243808.051695308, 4406397.202710291,-4561377.290892059,6852382.107835932]}); it works when I clicked on it but when I try to replace the coordinates by geofield.geometry.getBounds() the map doesn’t display.

I’ve just started having a look at OpenLayers 3 and am attempting to zoom to a single feature whose extent is to be a geoJSON object sent by the server (which will change at each refresh, so I can’t hard code the zoom /central point). I would like this to happen preferably as soon as the page loads, but I’m struggling to get it to work.

Right now, I store all active features in a separate array and calculate the extent from there. var coordinates = features.map(function(feature) {return feature.getGeometry().getCoordinates();}); var extent = ol . extent .boundingExtent(coordinates); – SomeBdyElse Dec 28 ’13 at 20:23, This map has a view that is constrained in an extent . This is done using the extent view option. Please note that specifying constrainOnlyCenter: true would only apply the extent restriction to the view center.

Advertiser