5

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?

5

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>
2

You need a filter - try something like:

<wfs:GetFeature service="WFS" version="1.1.0"
  xmlns:topp="http://www.openplans.org/topp"
  xmlns:wfs="http://www.opengis.net/wfs"
  xmlns:ogc="http://www.opengis.net/ogc"
  xmlns:gml="http://www.opengis.net/gml"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.opengis.net/wfs
                      http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">
  <wfs:Query typeName="topp:states">
    <wfs:PropertyName>topp:STATE_NAME</wfs:PropertyName>
    <wfs:PropertyName>topp:PERSONS</wfs:PropertyName>
    <ogc:Filter>
      <ogc:And>
        <ogc:BBOX>
          <ogc:PropertyName>the_geom</ogc:PropertyName>
          <gml:Envelope srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
             <gml:lowerCorner>-75.102613 40.212597</gml:lowerCorner>
             <gml:upperCorner>-72.361859 41.512517</gml:upperCorner>
          </gml:Envelope>
        </ogc:BBOX>
      <ogc:PropertyIsEqualTo>
        <ogc:PropertyName>topp:STATE_NAME</ogc:PropertyName>
        <ogc:Literal>Pennsylvania</ogc:Literal>
      </ogc:PropertyIsEqualTo>
    </ogc:And>
   </ogc:Filter>
  </wfs:Query>
</wfs:GetFeature>
  • Thank you for your response, actually already know about that, but what I'm currently didn't know is what is the parameter for the filter thing. I added an answer for that based on my research on OSGeo – Crazenezz May 28 '12 at 8:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.