[Geoserver-users] I have a question

Hello Dear Justin,
I have a question.According to the tutorial of Geoserver wfs,I know how to query with a bbox.But there are only a foursquare or a quadrate areas as a bbox.I want to konw how to query features within a tilt rectangles area as a bbox.For example, we query some hotels and restaurants around a tilt road within 1.5km.I hope you can spare your time to see my problem during your busy time.Thank you very much.
Sincerely yours,
Yang.


想加入吗?1.9亿用户正在使用网易邮箱 >>

yangzhaohui ha scritto:

Hello Dear Justin,
    I have a question.According to the tutorial of Geoserver wfs,I know how to query with a bbox.But there are only a foursquare or a quadrate areas as a bbox.I want to konw how to query features within a tilt rectangles area as a bbox.For example, we query some hotels and restaurants around a tilt road within 1.5km.I hope you can spare your time to see my problem during your busy time.Thank you very much.

Hum,
I think you're referring to the WFS GetFeature GET request.
In that request, you'll have to encode an OGC filter to use a geometry
other than a rectangle with sides parallel to the axis.

The following request is among the 1.5.0 sample requests, and
checks for geometric intersection:
wfs?request=GetFeature&typeName=topp:states&outputFormat=GML2&FILTER=%3CFilter%20xmlns:gml=%22http://www.opengis.net/gml%22%3E%3CIntersects%3E%3CPropertyName%3Ethe_geom%3C/PropertyName%3E%3Cgml:Point%20srsName=%224326%22%3E%3Cgml:coordinates%3E-74.817265,40.5296504%3C/gml:coordinates%3E%3C/gml:Point%3E%3C/Intersects%3E%3C/Filter%3E

the equivalent, more readable version as a POST request is:

<wfs:GetFeature service="WFS" version="1.0.0"
   outputFormat="GML2"
   xmlns:topp="http://www.openplans.org/topp&quot;
   xmlns:wfs="http://www.opengis.net/wfs&quot;
   xmlns="http://www.opengis.net/ogc&quot;
   xmlns:gml="http://www.opengis.net/gml&quot;
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
   xsi:schemaLocation="http://www.opengis.net/wfs
                       http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd&quot;&gt;
   <wfs:Query typeName="topp:states">
     <Filter>
       <Intersects>
         <PropertyName>the_geom</PropertyName>
           <gml:Point srsName="http://www.opengis.net/gml/srs/epsg.xml#4326&quot;&gt;
             <gml:coordinates>-74.817265,40.5296504</gml:coordinates>
           </gml:Point>
         </Intersects>
       </Filter>
   </wfs:Query>
</wfs:GetFeature>

The geometry can be whatever you want. To encode these, you'll
have to read the filter encoding and the gml2 specs, respectively.

Oh, if you're using Geoserver 1.5.0 you can use also the
simplified CQL syntax, see http://docs.codehaus.org/display/GEOSDOC/WFS+vendor+parameters

Cheers
Andrea