Skip to main content
Solved

WFS query


boubcher
Contributor
Forum|alt.badge.img+11

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

Best answer by nielsgerrits

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".

View original
Did this help you find an answer to your question?

9 replies

danilo_fme
Evangelist
Forum|alt.badge.img+41
  • Evangelist
  • May 21, 2018

Yes @boubcher

The reader WFS is possible to retrieve only specific features:

Parameters - Feature Types

Thanks,

Danilo


boubcher
Contributor
Forum|alt.badge.img+11
  • Author
  • Contributor
  • May 21, 2018

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 )


danilo_fme
Evangelist
Forum|alt.badge.img+41
  • Evangelist
  • May 21, 2018
boubcher wrote:

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

 

 


nielsgerrits
VIP
  • Best Answer
  • May 22, 2018

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".


boubcher
Contributor
Forum|alt.badge.img+11
  • Author
  • Contributor
  • May 22, 2018

@nielsgerrits

Thanks for the response we will test it

 


boubcher
Contributor
Forum|alt.badge.img+11
  • Author
  • Contributor
  • May 24, 2018

@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
VIP
boubcher wrote:

@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.

brianatsafe
Safer
Forum|alt.badge.img+11

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>

deanatsafe
Safer
Forum|alt.badge.img+6
  • Safer
  • June 20, 2018

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?


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings