[OpenLayers-Users] Using Filter parameter in WFS request
lorkyo
lorkyo at 163.com
Wed Aug 27 03:22:51 EDT 2008
hi Eric Lemoine:
Thank you very much. It may be may be that my problem is caused by the bound conflict of the bounds. But after I set the filter to get all the features of the layer, the wfs layer cannot appear either, and if I remove the filter parameter, the wfs layer will appear on the map. I'm very confused with this. So thank you very much for replying.
Best Regards.
ÔÚ2008-08-26£¬"Eric Lemoine" <eric.c2c at gmail.com> дµÀ£º
>Hi. Layer.WFS already sets a bbox param in the GetFeature request, and
>bbox is incompatible with filter. I'm not familiar enough with
>GeoServer to be sure, but it may be that the bbox param takes
>precedence over the filter one. With MapServer 4 filter takes
>precedence over bbox, while MapServer 5 returns an error. Hope this
>helps. Eric
>
>2008/8/25, lorkyo :
>> 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/20080827/bf096150/attachment.html
More information about the Users
mailing list