<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi Herman,<br>
maybe you're looking for s.th. like this:<br>
<br>
get the bounds of a feature: <br>
var bounds = features[i].geometry.getBounds();<br>
<br>
calculate zoom and zoom to the feature::<br>
var desiredZoom = map.getZoomForExtent(bounds);<br>
map.setCenter(bounds.getCenterLonLat(), desiredZoom);<br>
<br>
for more information look at: <br>
<pre wrap=""><a class="moz-txt-link-freetext"
href="http://trac.openlayers.org/wiki/Addins/ZoomToFeatures">http://trac.openlayers.org/wiki/Addins/ZoomToFeatures</a>
hope this helped.
cheers, Marco
</pre>
<br>
<br>
Am 27.01.2010 09:21, schrieb Herman Badenhorst:
<blockquote
cite="mid:ca12e5d81001270021n111d5ff6xada5d3969678f684@mail.gmail.com"
type="cite">Hi group.<br>
<br>
I need to implement the functionality where the map automatically
zoom's to a feature after the map is loaded.<br>
<br>
Thus, my url will look something like this: <a moz-do-not-send="true"
href="http://host/MapViewer.php?SelectedUnit=123">http://host/MapViewer.php?SelectedUnit=123</a><br>
<br>
The request parameter is the value of the 'unit' attribute in my layer.<br>
<br>
Is there a way to get the bounds for this feature based on the
attribute? Then the zoom would be easy to implement.<br>
<br>
Regards,<br>
Herman<br>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@openlayers.org">Users@openlayers.org</a>
<a class="moz-txt-link-freetext" href="http://openlayers.org/mailman/listinfo/users">http://openlayers.org/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
</body>
</html>