Hello,<br><br>the workaround suggested by Tim will do it, because I want to zoom to a single feature at this time.<br>Thanks for the help, guys!<br><br>Cheers,<br>Dmitri<br><br><div><span class="gmail_quote">2007/7/6, Erik Uzureau &lt;
<a href="mailto:erik.uzureau@metacarta.com">erik.uzureau@metacarta.com</a>&gt;:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">I would note that the work that I&#39;m doing in my untiled3 branch could
<br>be helpful for this.<br><br>The problem is that WFS layer is no longer subclassed off of grid. I<br>think this is a mistake, but so be it.<br><br>At the very least, the work with sending loadStart and loadEnd events<br>
can be a good model.<br><br>--erik<br><br><br>On 7/6/07, Tim Schaub &lt;<a href="mailto:noreply@geocartic.com">noreply@geocartic.com</a>&gt; wrote:<br>&gt; Hey Dmitri-<br>&gt;<br>&gt; Dmitri Mizerkin wrote:<br>&gt; &gt; Hi!
<br>&gt; &gt;<br>&gt; &gt; I haven&#39;t got any reaction to my previous mail, so I&#39;m trying to point<br>&gt; &gt; your attention to my problem again in this follow-up.<br>&gt; &gt; The problem is: after loading a GML layer the features collection of the
<br>&gt; &gt; layer stays empty (at least for some time), which means that there&#39;s no<br>&gt; &gt; way to handle those in the loadend-event of the layer. Is there another<br>&gt; &gt; event, which is raised after the features collection of the loaded layer
<br>&gt; &gt; is initialized? Is there any rational workaround?<br>&gt;<br>&gt; You&#39;re right.&nbsp;&nbsp;There is no good way to do what you want right now.&nbsp;&nbsp;I<br>&gt; assume you&#39;re talking about the WFS layer in vector mode (as opposed to
<br>&gt; marker mode).&nbsp;&nbsp;When the tile for this layer is drawn a WFS request is<br>&gt; made asynchronously - when this request returns, the GML is parsed and<br>&gt; added to your layer.&nbsp;&nbsp;As each feature is added to your layer, the
<br>&gt; optional onFeatureInsert property of your layer (a function) is called.<br>&gt;&nbsp;&nbsp; This is not handy if you want to know when the features are done being<br>&gt; added.<br>&gt;<br>&gt; I thought there was a ticket out there already for this.&nbsp;&nbsp;I&#39;ll check -
<br>&gt; and add one if not.<br>&gt;<br>&gt; I&#39;m hoping to do some work on the WFS layer in the near future.&nbsp;&nbsp;This<br>&gt; and other issues will likely get addressed then.<br>&gt;<br>&gt; Tim<br>&gt;<br>&gt;<br>&gt; &gt;
<br>&gt; &gt; Cheers,<br>&gt; &gt; Dmitri Mizerkin<br>&gt; &gt;<br>&gt; &gt; ---------- Forwarded message ----------<br>&gt; &gt; From: *Dmitri Mizerkin* &lt;<a href="mailto:eisberg@gmail.com">eisberg@gmail.com</a> &lt;mailto:
<a href="mailto:eisberg@gmail.com">eisberg@gmail.com</a>&gt;&gt;<br>&gt; &gt; Date: 05.07.2007 10:33<br>&gt; &gt; Subject: Problem with GML features<br>&gt; &gt; To: <a href="mailto:users@openlayers.org">users@openlayers.org
</a> &lt;mailto:<a href="mailto:users@openlayers.org">users@openlayers.org</a>&gt;<br>&gt; &gt;<br>&gt; &gt; Hello everybody!<br>&gt; &gt;<br>&gt; &gt; I&#39;m experiencing problems with handling the features of a GML layer,
<br>&gt; &gt; which is loaded when the page is opened. The problem is that after the<br>&gt; &gt; &#39;loanend&#39; event is raised, the features-property of the layer stays<br>&gt; &gt; empty for some more time, so there is no way to examine the features in
<br>&gt; &gt; this handler. In my case I need to extract the bounds-properties of the<br>&gt; &gt; features to construct an common bounds-object for zooming (the action<br>&gt; &gt; should simulate feature selection and zooming to the selection).
<br>&gt; &gt;<br>&gt; &gt; Any ideas, how this could work?<br>&gt; &gt;<br>&gt; &gt; Here&#39;s my code snapshot:<br>&gt; &gt;<br>&gt; &gt; function SelectFeature() {<br>&gt; &gt;&nbsp;&nbsp; var layer = GetLayerByName(FEATURE_LAYER); //returns a MapServer layer
<br>&gt; &gt; to send a request on<br>&gt; &gt;&nbsp;&nbsp; if (layer == null)<br>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; return;<br>&gt; &gt;&nbsp;&nbsp; var selection_url = CreateWFSGetFeatureRequest(layer, FIELD_NAME,<br>&gt; &gt; FIELD_VALUE); //creates a WFS GetFeature-request
<br>&gt; &gt;&nbsp;&nbsp; if ((selection != null)&amp;&amp;(selection.map != null)) {<br>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; OLMap.removeLayer (selection);<br>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; selection = null;<br>&gt; &gt;&nbsp;&nbsp; }<br>&gt; &gt;&nbsp;&nbsp; selection = new OpenLayers.Layer.GML
(&quot;Selected Objects&quot;, selection_url);<br>&gt; &gt;&nbsp;&nbsp; OLMap.addLayer(selection);<br>&gt; &gt;&nbsp;&nbsp; selection.displayInLayerChooser = false;<br>&gt; &gt;&nbsp;&nbsp; selection.events.register (&quot;loadend&quot;, selection, ZoomToSelection);
<br>&gt; &gt;&nbsp;&nbsp; selection.events.triggerEvent(&quot;loadend&quot;);<br>&gt; &gt; }<br>&gt; &gt;<br>&gt; &gt; function ZoomToSelection() {<br>&gt; &gt;&nbsp;&nbsp; var bounds = ComputeSelectionBounds();<br>&gt; &gt;&nbsp;&nbsp; if (bounds == null)
<br>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; return;<br>&gt; &gt;&nbsp;&nbsp; OLMap.zoomToExtent(bounds);<br>&gt; &gt; }<br>&gt; &gt;<br>&gt; &gt; Thanks in advance!<br>&gt; &gt;<br>&gt; &gt; --<br>&gt; &gt; Regards,<br>&gt; &gt; Dmitri<br>&gt; &gt;<br>&gt; &gt; --
<br>&gt; &gt; Gruß,<br>&gt; &gt; Dmitri<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt; ------------------------------------------------------------------------<br>&gt; &gt;<br>&gt; &gt; _______________________________________________
<br>&gt; &gt; Users mailing list<br>&gt; &gt; <a href="mailto:Users@openlayers.org">Users@openlayers.org</a><br>&gt; &gt; <a href="http://openlayers.org/mailman/listinfo/users">http://openlayers.org/mailman/listinfo/users
</a><br>&gt;<br>&gt; _______________________________________________<br>&gt; Users mailing list<br>&gt; <a href="mailto:Users@openlayers.org">Users@openlayers.org</a><br>&gt; <a href="http://openlayers.org/mailman/listinfo/users">
http://openlayers.org/mailman/listinfo/users</a><br>&gt;<br>_______________________________________________<br>Users mailing list<br><a href="mailto:Users@openlayers.org">Users@openlayers.org</a><br><a href="http://openlayers.org/mailman/listinfo/users">
http://openlayers.org/mailman/listinfo/users</a><br></blockquote></div><br>