[OpenLayers-Dev] Setting maxExtent on WFS

Steven M. Ottens steven at minst.net
Fri Jul 30 08:54:03 EDT 2010


Hi all,

I'm trying to set a maxextent on a WFS so it doesn't try to request 
features when the layer isn't in view. Just adding a maxExtent to the 
layer isn't working. When the area is outside the viewport, the WFS is 
still being queried. I've checked with a WMS layer and the maxExtent 
itself is working as I hoped.
I'm currently using a vector layer with a BBOX strategy, should I use a 
different strategy? Or if it isn't possible by default, can someone give 
me pointers where I should start hacking?

The configuration of the WFS layer is:
     ,skGN : new OpenLayers.Layer.Vector("Norway GN",
         {
         maxExtent: new OpenLayers.Bounds(5,58,10,62),
         displayOutsideMaxExtent: false,
         strategies: [new OpenLayers.Strategy.BBOX({resFactor: 1})],
             visibility: true,
             styleMap: GeoViewer.Styles.pointStyles,

             projection: new OpenLayers.Projection("EPSG:4258"),
             protocol: new OpenLayers.Protocol.WFS({
                 formatOptions: {xy: true}, //Set to false for latitude 
longitude order
                 version: "1.1.0",
                 outputFormat: "text/xml; subtype=gml/3.2.1",
                 srsName: "EPSG:4258",
                 extractAttributes:true,
                 url: GeoViewer.Catalog.urls.SK_WFS,
                 featurePrefix: "gn",
                 featureType: "NamedPlace",
                 featureNS: 
"urn:x-inspire:specification:gmlas:GeographicalNames:3.0",
                 geometryName: "geometry",
                 maxFeatures: "50",
                 schema: 
"http://esdin.geodan.nl/fgi/SK/deegree2-wfs/services?service=WFS&version=1.1.0&request=DescribeFeatureType&typeName=GN:NamedPlace&namespace=xmlns=(GN=urn:x-inspire:specification:gmlas:GeographicalNames:3.0)"
             })
         }
     )

Regards,
Steven




More information about the Dev mailing list