I have an openlayers map with a pair of POIs and I want to zoom in so that they all match the map I am making with the following code:
var bbox = new OpenLayers.Bounds( <?php echo $this->box->getSmallestLongitude() ?>, <?php echo $this->box->getSmallestLatitude() ?>, <?php echo $this->box->getLargestLongitude() ?>, <?php echo $this->box->getLargestLatitude() ?> ).transform(map.displayProjection, map.projection); map.zoomToExtent(bbox);
Now, as you have already noticed: I have to map.zoomTo manually; since map.zoomToExtent really sets the center correctly; but scales to 0 ....
Any ideas as to why it won't calculate scaling for the first time?
source share