[OpenLayers-Users] Can OpenLayers.Layer.WFS construction method support "Filter" Parameter?

lorkyo lorkyo at 163.com
Mon Sep 1 11:57:19 EDT 2008


Hello,
Dose the OpenLayers.Layer.WFS construction method support the Filter method.I cannot get the WFS layer after I add a Filter parameter to the OpenLayers.Layer.WFS construction method.The code is like this:
layer = new OpenLayers.Layer.WFS(
    "Analyze (WFS)", 
    "http://192.168.6.140:8080/geoserver/wfs",
    { 
     request: 'GetFeature',
     typeName:'topp:analyze',
     FILTER:'%3Cogc:Filter%20xmlns:ogc=%22http://www.opengis.net/ogc%22%3E%3C/ogc:Filter%3E'
},
 {maxResolution: 3.986275569928255E-5, projection: "EPSG:4326", buffer: 0},
 { featureClass: OpenLayers.Feature.WFS}
     
               );
     map.addLayer(layer);
But after I remove the filter parameter,the WFS layer will appear on the map. The code is below:
layer = new OpenLayers.Layer.WFS(
    "Analyze (WFS)", 
    "http://192.168.6.140:8080/geoserver/wfs",
    { 
     request: 'GetFeature',
     typeName:'topp:analyze'
},
 {maxResolution: 3.986275569928255E-5, projection: "EPSG:4326", buffer: 0},
 { featureClass: OpenLayers.Feature.WFS}
     
               );
     map.addLayer(layer);
And what's more I can get the GML result by directly typing the request in the browser:   http://192.168.6.140:8080/geoserver/wfs?request=GetFeature&typeName=topp:analyze&FILTER=%3Cogc:Filter%20xmlns:ogc=%22http://www.opengis.net/ogc%22%3E%3C/ogc:Filter%3E
The result is below:
 <?xml version="1.0" encoding="UTF-8" ?>
-<wfs:FeatureCollection xmlns="http://www.opengis.net/wfs" xmlns:wfs="http://www.opengis.net/wfs" xmlns:topp="http://www.openplans.org/topp" xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openplans.org/topp http://192.168.6.140:8080/geoserver/wfs/DescribeFeatureType?typeName=topp:analyze http://www.opengis.net/wfs http://192.168.6.140:8080/geoserver/schemas/wfs/1.0.0/WFS-basic.xsd">
-<gml:boundedBy>
-<gml:Box srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
 <gml:coordinates xmlns:gml="http://www.opengis.net/gml" decimal="." cs="," ts="">97.51721382,0.00470831 97.52223518,0.00781349</gml:coordinates>
 </gml:Box>
 </gml:boundedBy>
-<gml:featureMember>
-<topp:analyze fid="analyze.1">
-<topp:the_geom>
-<gml:MultiLineString srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
-<gml:lineStringMember>
-<gml:LineString>
 <gml:coordinates xmlns:gml="http://www.opengis.net/gml" decimal="." cs="," ts="">97.51721382,0.00540555 97.51963792,0.00542299</gml:coordinates>
 </gml:LineString>
 </gml:lineStringMember>
 </gml:MultiLineString>
 </topp:the_geom>
 <topp:Id>1</topp:Id>
 </topp:analyze>
 </gml:featureMember>
 </wfs:FeatureCollection>
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20080901/c371934f/attachment.html


More information about the Users mailing list