Hello everybody!<br><br>I'm experiencing problems with handling the features of a GML layer, which is loaded when the page is opened. The problem is that after the 'loanend' event is raised, the features-property of the layer stays empty for some more time, so there is no way to examine the features in this handler. In my case I need to extract the bounds-properties of the features to construct an common bounds-object for zooming (the action should simulate feature selection and zooming to the selection).
<br><br>Any ideas, how this could work?<br><br>Here's my code snapshot:<br><br>function SelectFeature() {<br> var layer = GetLayerByName(FEATURE_LAYER); //returns a MapServer layer to send a request on<br> if (layer == null)
<br> return;<br> var selection_url = CreateWFSGetFeatureRequest(layer, FIELD_NAME, FIELD_VALUE); //creates a WFS GetFeature-request<br> if ((selection != null)&&(selection.map != null)) {<br> OLMap.removeLayer
(selection);<br> selection = null; <br> }<br> selection = new OpenLayers.Layer.GML("Selected Objects", selection_url);<br> OLMap.addLayer(selection);<br> selection.displayInLayerChooser = false;<br> selection.events.register
("loadend", selection, ZoomToSelection);<br> selection.events.triggerEvent("loadend");<br>}<br><br>function ZoomToSelection() {<br> var bounds = ComputeSelectionBounds();<br> if (bounds == null)<br>
return;<br> OLMap.zoomToExtent(bounds);<br>}<br clear="all"><br>Thanks in advance!<br><br>-- <br>Regards,<br>Dmitri