[OpenLayers-Users] Zoom to a WFS filter feature
goeserver developer
bjoice at firstam.com
Tue Nov 27 02:59:04 EST 2007
Hi,
thanks, Its working fine on FF except some problem with IE .
Eric Lemoine-3 wrote:
>
> Hi
>
>
>
> getBounds()
>
> On Nov 26, 2007 12:47 PM, goeserver developer <bjoice at firstam.com> wrote:
>>
>> Hi
>>
>> I have added a wfs layer with the filter option . Now I want to zoom to
>> it
>> .I am be able to do it with :
>>
>> bounds = new
>> OpenLayers.Bounds(-9441241.90017852,4636148.46449042,-8963467.99653102,5159004.74932964);//
>> state :ohio
>> map.zoomToExtent(bounds);
>> but I have to do it Dynamically .How can I get the bounds ? Below is the
>> output of that same filter.how can I extract the gml:coordinates .
>
> You can loop over your features' geometries and calculate the bounding
> box. Code would loolk like this:
>
> bbox = null;
> for (var i = 0; i < wfsLayer.features.length; i++) {
> var geometry = wfsLayer.features[i].geometry;
> if (bbox == null) {
> bbox = geometry.getBounds().clone();
> } else {
> bbox.extend(geometry.getBounds());
> }
> }
>
> Warning: absolutely untested!
>
> --
> Eric
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
>
--
View this message in context: http://www.nabble.com/Zoom-to-a-WFS-filter-feature-tf4874716.html#a13966258
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list