Search code examples
gisgeoserver

WFS Request Layer (GML) with Filter


Is there a solution to request the GML layer from Geoserver with filter like using bbox:

http://localhost:8080/geoserver/tiger/ows?service=WFS&version=1.0.0&
request=GetFeature&typeName=tiger:poi&maxFeatures=50&
bbox=-74.0104611,40.70758763,-74.00153046439813,40.719885123828675

The result will be specific filtering the bounding box (lat/lon), based on bbox parameter that user entered.

The Result:

<wfs:FeatureCollection xsi:schemaLocation="http://www.census.gov http://127.0.0.1:8080/geoserver/tiger/wfs?service=WFS&version=1.0.0&request=DescribeFeatureType&typeName=tiger%3Apoi http://www.opengis.net/wfs http://127.0.0.1:8080/geoserver/schemas/wfs/1.0.0/WFS-basic.xsd">
    <gml:boundedBy>
        <gml:null>unknown</gml:null>
    </gml:boundedBy>
    <gml:featureMember>
        <tiger:poi fid="poi.4">
            <tiger:the_geom>
                <gml:Point srsName="http://www.opengis.net/gml/srs/epsg.xml#4326"><gml:coordinates decimal="." cs="," ts=" ">-74.00857344,40.71194565</gml:coordinates></gml:Point>
            </tiger:the_geom>
            <tiger:NAME>lox</tiger:NAME>
            <tiger:THUMBNAIL>pics/22037884-Ti.jpg</tiger:THUMBNAIL>
            <tiger:MAINPAGE>pics/22037884-L.jpg</tiger:MAINPAGE>
         </tiger:poi></gml:featureMember>
</wfs:FeatureCollection>

The problem now, I want to filter the data based on the <tiger:NAME>lox</tiger:NAME>, already tried with entered the tiger:NAME=lox as a parameter when request, the result just same like when enter no parameter. Is there a solution for this?


Solution

  • Based on Filter Encoding with Spatial Filter within WFS-Request and Geoserver Filter. I found that there is a parameter named filter and the value can enter like this:

    http://localhost:8080/geoserver/tiger/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=tiger:poi&maxFeatures=2&filter=<PropertyIsEqualTo><PropertyName>NAME</PropertyName><Literal>lox</Literal></PropertyIsEqualTo>