Skip to main content

Hello

I am using a WFS reader to extract data, is there any way we could query the WFS to retrieve only specific features

Thanks

Yes @boubcher

The reader WFS is possible to retrieve only specific features:

Parameters - Feature Types

Thanks,

Danilo


Thanks, Danilo

we don't have a problem with the feature type, but we looking to retrieve only certain features within this feature type (ex: date = d/m/y )


Thanks, Danilo

we don't have a problem with the feature type, but we looking to retrieve only certain features within this feature type (ex: date = d/m/y )

Could you share us your example, print , log or URL to WFS?

 

 

Thanks,

 

 

Danilo

 

 


Yes, you can use XML Filter Expression to get specific features. By default Filter Encoding should work.

Filter Encoding example: This GET request will return only the features with the field "identificatie" =  "420100000006908".

The decomposed request is:

http://geodata.nationaalgeoregister.nl/bag/wfs?
&service;=wfs
&version;=1.0.0
&request;=getfeature
&typename;=bag:pand
&Filter;=
<PropertyIsEqualTo>
<PropertyName>
identificatie
</PropertyName>
<Literal>
420100000006908
</Literal>
</PropertyIsEqualTo>

0684Q00000ArK1nQAF.png

Be aware: 

- You have to enter Pretty-Print XML in the field XML Filter Expression to make it work.

<PropertyIsEqualTo>
    <PropertyName>
        identificatie
    </PropertyName>
    <Literal>
        420100000006908
    </Literal>
</PropertyIsEqualTo>

- Filter operations are case sensitive. 

- If you query WFS version 2.0.0 you have to use namespace, as documented.

wfsxmlfilter2018.fmw

You might be able to use Filter Functions if the server allows this. Check the GetCapabilities, search "Function_Names" under "Filter_Capabilities".


@nielsgerrits

Thanks for the response we will test it

 


@nielsgerrits

we have a large dataset, could we use the WFS in order to download the entire dataset, if not is there any alternative?

Thanks


@nielsgerrits

we have a large dataset, could we use the WFS in order to download the entire dataset, if not is there any alternative?

Thanks

@boubcher Better post this as a new question. This way other people can find the answer as well. The short answer is yes. If the service is 2.0.0 and the server allows it you can work around the max features limit using response paging, this downloads the complete set in several requests. But you might violate the terms of service for this specific wfs, trying to download the complete set. The server side admin might block you. At least the server should have a hard time processing all your requests. I never had great results using response paging with really big datasets. You better mail the owner, requesting a dump.

Hi @boubcher,

 

 

The XML Filter example from @nielsgerrits looks great. You happened to mention to me that this was an Esri WFS service so I was able to get this to work further by adding the OGC namespace to the request. See:

 

https://gis.stackexchange.com/questions/111356/cant-figure-out-wfs-url-filter-what-ami-doing-wrong

 

 

E.g.

 

<ogc:Filter></ogc:Filter>

Many WFS servers also support stored queries as a way of making it easier to execute complex queries especially across multiple feature types. see: https://knowledge.safe.com/idea/72814/add-support-for-ogc-wfs-stored-queries.html?


Reply