[OpenLayers-Users] Problem with GML features
Dmitri Mizerkin
eisberg at gmail.com
Thu Jul 5 04:33:24 EDT 2007
Hello everybody!
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).
Any ideas, how this could work?
Here's my code snapshot:
function SelectFeature() {
var layer = GetLayerByName(FEATURE_LAYER); //returns a MapServer layer to
send a request on
if (layer == null)
return;
var selection_url = CreateWFSGetFeatureRequest(layer, FIELD_NAME,
FIELD_VALUE); //creates a WFS GetFeature-request
if ((selection != null)&&(selection.map != null)) {
OLMap.removeLayer(selection);
selection = null;
}
selection = new OpenLayers.Layer.GML("Selected Objects", selection_url);
OLMap.addLayer(selection);
selection.displayInLayerChooser = false;
selection.events.register("loadend", selection, ZoomToSelection);
selection.events.triggerEvent("loadend");
}
function ZoomToSelection() {
var bounds = ComputeSelectionBounds();
if (bounds == null)
return;
OLMap.zoomToExtent(bounds);
}
Thanks in advance!
--
Regards,
Dmitri
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20070705/ca43b724/attachment.html
More information about the Users
mailing list