[OpenLayers-Users] Using Filter parameter in WFS request.
lorkyo
lorkyo at 163.com
Mon Aug 25 11:46:12 EDT 2008
Hi,
I have come accross the layer when I use add Filter parameters to request features. part of my codes are below and the features are not shown in the map:
***********code**********
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%3Cogc:PropertyIsGreaterThan%3E%3Cogc:PropertyName%3EId%3C/ogc:PropertyName%3E%3Cogc:Literal%3E0%3C/ogc:Literal%3E%3C/ogc:PropertyIsGreaterThan%3E%3C/ogc:Filter%3E'
},
{maxExtent: bounds, maxResolution: 3.986275569928255E-5, projection: "EPSG:4326", buffer: 0},
{ featureClass: OpenLayers.Feature.WFS}
);
map.addLayer(layer);
***********code**********
The feature is not shown on the map. However, after remove the parameter Filter like below, the wfs layer then appear on the map:
***********code**********
layer = new OpenLayers.Layer.WFS(
"Analyze (WFS)",
"http://192.168.6.140:8080/geoserver/wfs",
{
request: 'GetFeature',
typeName:'topp:analyze'},
{maxExtent: bounds, maxResolution: 3.986275569928255E-5, projection: "EPSG:4326", buffer: 0},
{ featureClass: OpenLayers.Feature.WFS});
map.addLayer(layer);
**********code****************
And I'm sure with the value filter because I can get the result through browser with following url which is copied from the former js code:
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%3Cogc:PropertyIsGreaterThan%3E%3Cogc:PropertyName%3EId%3C/ogc:PropertyName%3E%3Cogc:Literal%3E0%3C/ogc:Literal%3E%3C/ogc:PropertyIsGreaterThan%3E%3C/ogc:Filter%3E
the result appear on my browser after I typed this url is:
*******************
<?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/topphttp://192.168.6.140:8080/geoserver/wfs/DescribeFeatureType?typeName=topp:analyzehttp://www.opengis.net/wfshttp://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>
So have anyone encountered this problem or can help me find out why?
Best regards!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20080825/5e963cc0/attachment.html
More information about the Users
mailing list