[OpenLayers-Users] Setting the map center with a bounding box?
Atle Frenvik Sveen
atle.frenvik.sveen at geomatikk.no
Tue Jan 26 03:46:28 EST 2010
What you can do is use the .getCenterLonLat() method on the bbox you get
from the points. I.e. something like:
var bounds = this.layer.getDataExtent(); //or get your bounds somehow
else
var zoom = this.map.getZoomForExtent(bounds);
this.map.setCenter(bounds.getCenterLonLat(),zoom);
-atle
On Mon, 2010-01-25 at 11:06 -0500, Robert Hicks wrote:
> Hey all, is it possible to call OpenLayers.Map.setCenter(); but with a
> bounding box instead of a lat lon (point), or an equivalent
> functionality? The reason for this is I need my map to load based on
> the minimum bounding rectangle of a bunch of points. I didn't see
> anything in the api except for specifying a point, which won't work
> because I need the extent to be determined by the MBR.
>
--
Atle Frenvik Sveen
Geomatikk IKT AS
tel: 45 27 86 89
mail. atle.frenvik.sveen at geomatikk.no
More information about the Users
mailing list