Question

Count features with API

  • 8 November 2016
  • 5 replies
  • 2 views

Badge +11

Hi,

before actually reading the features from an API, I need to count the number of features that will enter. Based on the number, I need to split the search envelope into smaller pieces.

When using the HTTPCaller, I use following URL:

https://geo.onroerenderfgoed.be/geoserver/vioe_geoportaal/wfs?request=GetFeature&version;=1.1.0&resultType;=hits&typeName;=beschermde_archeologische_zones

However, I don't see a way to use a clipping envelope here.

When using the FeatureReader, WFS flavour, it is easy to use the clipping envelope, but I do not see how to enter the parameter resultType=hits.

A possible workaround is to set a Max number of features in the FeatureReader. When that number is achieved, go through a loop until it is lower. However, that means that you actually have to download all the objects and it takes more time.

My preferred solution would be a way to use a search envelope in the HTTPCaller. Any suggestions on how to achieve this?


5 replies

Badge +16

Hoi @jelle, I see only 30 features in the beschermde_archeologische_zones feature type and that the service countdefault is set to 20000 features so you can easly request all the features and then spatially relate them to your areas.

Badge +11

Hoi @jelle, I see only 30 features in the beschermde_archeologische_zones feature type and that the service countdefault is set to 20000 features so you can easly request all the features and then spatially relate them to your areas.

some layers contain more than 10K objects and then it starts taking time. This was just one of the layers to be read.

 

 

Badge +16
some layers contain more than 10K objects and then it starts taking time. This was just one of the layers to be read.

 

 

Then I would use the 2.0.0 version with responce paging to request the features but I doubt if that will sped up things, its usually the onderlaying server/database that is the bottleneck.

 

 

 

Userlevel 4
Badge +25

Hi @jelle

Maybe you can add the coordinate system and bounding box to the original URL?

For example:

https://geo.onroerenderfgoed.be/geoserver/vioe_geoportaal/wfs?request=GetFeature&version;=1.1.0&resultType;=hits&typeName;=beschermde_archeologische_zones&srsName;=EPSG:99999&bbox;=12345,12345,12345,12345

Badge +11

That works. Thanks Mark!

Reply