Hi Herman,
maybe you're looking for s.th. like this:

get the bounds of a feature:
var bounds = features[i].geometry.getBounds();

calculate zoom and zoom to the feature::
var desiredZoom = map.getZoomForExtent(bounds);
map.setCenter(bounds.getCenterLonLat(), desiredZoom);

for more information look at:

http://trac.openlayers.org/wiki/Addins/ZoomToFeatures

hope this helped.
cheers, Marco



Am 27.01.2010 09:21, schrieb Herman Badenhorst:
Hi group.

I need to implement the functionality where the map automatically zoom's to a feature after the map is loaded.

Thus, my url will look something like this: http://host/MapViewer.php?SelectedUnit=123

The request parameter is the value of the 'unit' attribute in my layer.

Is there a way to get the bounds for this feature based on the attribute? Then the zoom would be easy to implement.

Regards,
Herman


_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users

_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users

Reply via email to