WFS filter query
Bart van den Eijnden
bartvde at XS4ALL.NL
Tue Mar 15 08:55:33 PST 2005
Hi,
if you use the HTTP GET interface, you need to provide the same filter, so
for my situation:
http://myserver/cgi-bin/mapserv.exe?map=/ms4w/apps/general/map/provincies.map&SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=Provincies&FILTER=<ogc:Filter><ogc:BBOX><PropertyName>MS_GEOMETRY</PropertyName><gml:Box><gml:coordinates>121000,469000
140000,470000</gml:coordinates></gml:Box></ogc:BBOX></ogc:Filter>
You do need to specify the propertyName *inside the BBOX filter*, this is
the spatial column, Mapserver has a default of MS_GEOMETRY, which you can
also see by doing a DescribeFeatureType request on your WFS. This is
something else than the propertyName *outside the Filter* which you are
talking about, which can be used to only retrieve some attributes, which
is however not implemented in Mapserver.
Did you try adapting my example for your situation? I don't use the wfs
namespace (GetFeature instead of wfs:GetFeature), and don't provide the
XML header which you do.
Is GetCapabilities and DescribeFeatureType working?
Good luck.
Best regards,
Bart
> Hi Bart,
>
> Thank you for your email.
>
> The only difference between your example and mine is "PropertyName" under
> the <ogc:BBOX>. I think "PropertyName" is optional to specify returned
> elements. Does "<PropertyName>MS_GEOMETRY</PropertyName>" mean that
> spatial
> BBOX query should use the column "MS_GEOMETRY"? I use .shp files.
>
> Should I change my map file (or mapserver, which works for non Filter
> requests) to support the Filter and/or BBOX query? When I use the URL
> request:
> http://localhost/cgi-bin/mapserv_44.exe?map=mymapfile&SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=myType&FILTER=<Filter><Within><gml:Box><gml><coordinates>0,0
> 600000,600000</gml:coordinates></gml:Box></Within></Filter>
>
> the mapserver told me this:
> msWFSGetFeature(): WFS server error. Invalid or Unsupported FILTER in
> GetFeature
>
> Thank you!
>
> N. Zhou
>
>>From: Bart van den Eijnden <bartvde at XS4ALL.NL>
>>Reply-To: bartvde at XS4ALL.NL
>>To: MAPSERVER-USERS at LISTS.UMN.EDU
>>Subject: Re: [UMN_MAPSERVER-USERS] WFS filter query
>>Date: Tue, 15 Mar 2005 16:33:28 +0100
>>
>>Hi,
>>
>>this works for me:
>>
>><GetFeature service="WFS" version="1.0.0"
>> maxFeatures="20"
>> xmlns="http://www.opengis.net/wfs"
>> xmlns:gml="http://www.opengis.net/gml"
>> xmlns:ogc="http://www.opengis.net/ogc"
>> xmlns:xlink="http://www.w3.org/1999/xlink"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xsi:schemaLocation="http://schemas.opengis.net/wfs/1.0.0
>> WFS-basic.xsd">
>> <Query typeName="gemeentes">
>> <ogc:Filter>
>> <ogc:BBOX>
>> <PropertyName>MS_GEOMETRY</PropertyName>
>> <gml:Box><gml:coordinates>121000,469000
>>140000,470000</gml:coordinates></gml:Box>
>> </ogc:BBOX>
>> </ogc:Filter>
>> </Query>
>></GetFeature>
>>
>>Best regards,
>>Bart
>>
>> > Hi,
>> >
>> > I have a problem of using WFS filter to get data within a bounding
>> box.
>>My
>> > WFS post request is:
>> >
>> > <?xml version=\"1.0\" ?>
>> > <wfs:GetFeature service="WFS" version="1.0.0" outputFormat="GML2"
>> > 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.0.0/WFS-basic.xsd">
>> > <wfs:Query typeName="mytype">
>> > <ogc:Filter>
>> > <ogc:BBOX>
>> > <gml:Box>
>> > <gml:coordinates>0,0 505234,5448023</gml:coordinates>
>> > </gml:Box>
>> > </ogc:BBOX>
>> > </ogc:Filter>
>> > </wfs:Query>
>> > </wfs:GetFeature>
>> >
>> > But the mapserver would stop with an error of "Premature end of script
>> > headers: mapserv_44.exe"
>> > Could anyone tell me why? I know there is a WFS bug of filtering some
>> > elements rather than getting all elements.
>> >
>> > Thank you very much!
>> >
>> > N. Zhou
>> >
>
More information about the MapServer-users
mailing list