[OpenLayers-Users] pass bounding box with WFS url to server

Phil Scadden p.scadden at gns.cri.nz
Thu Nov 14 12:14:06 PST 2013


>     Thanks for the update. Actually I am working on WFST so any how I need to
> have WFS layer. Please share if you have some good tips to make it more
> robust.
Do you mean WFS-T (with transactions), or WFST (with time)? I am lost as 
to why you be needing WFS-T for just displaying data. If you are using 
WFST, then use WMST for the display purposes and stick with WFS for query.

If there really is no way to use WMS, then you have a problem - if your 
application has more than say 500 geometry points, then your application 
is going to be slow.

Obviously, the way to reduce time is minimize the traffic but can you 
restrict the user to only looking at very small amount of geometry at 
time? If so, then I still think that do not want a WFS layer.  A 
strategy could look like this:

myWFSdata = new OpenLayers.Layer.Vector("My data",{});

wfsProtocol = new OpenLayers.Protocol.WFS.v1_1_0({
                     url: yourURL,
                     featurePrefix:yourPrefix,
                     featureType: yourFeaturetype,
                     srsName: yourSRS
                 });

A handler to fetch data (eg on map moveto), could be:
function (e) {
    var myfilter = new OpenLayers.Filter.Spatial({
                                 type: OpenLayers.Filter.Spatial.BBox
                                     etc
                             });
  wfsprotocol.read({
                                    filter:myFilter,
                                     callback:processQuery,
                                     scope:strategy
  });
};

The processQuery would do something like:
   function processQuery(request) {
    myWFSdata.destroyFeatures();
   myWFSdata.addFeatures(request.features);
}


I'd want to be really sure that there was no way to use WMS before I 
embarked on this though.






Notice: This email and any attachments are confidential.
If received in error please destroy and immediately notify us.
Do not copy or disclose the contents.



More information about the Users mailing list