eblondel / ows4R

R Interface for OGC Web-Services (OWS)

Home Page:https://eblondel.github.io/ows4R/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

WFS paging support

opened this issue · comments

Great work with this package!

It would be great if the WFS functionality would support paging.
Therefore, checking how many features are requested, what the per-request limit is, and iterate till all features are downloaded.

library(ows4R)
wfs <- WFSClient$new("https://geodata.nationaalgeoregister.nl/bag/wfs?", "2.0.0", logger = "DEBUG")
caps <- wfs$getCapabilities()

ft <- caps$findFeatureTypeByName("bag:pand")
ft$getDescription()`

sf <- ft$getFeatures(bbox = '110513.3,436371.4,174951.2,480440.6',resultType='hits')
getFeatures$resultType

This workaround to inform about the amount of features (resultType = 'hits') did not work, because the response of getFeatures is automatically coerced to a sf object, which renders an error since it contains no features.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Thanks @mcdesignnl for reporting this, I'll look at it ASAP.

@mcdesignnl I've added some code to manage resultType, see #30 when it's not set to features (default) but hits instead. For the WFS paging, I will look at it, but it requires more thinking how to refactor the actual code. This is a specific feature of WFS 2.0

@eblondel wow, thank you for adding this fix so soon. This allows me to implement a very rudimentary paging support myself.

@mcdesignnl in case you still need this, i've added WFS paging support.
To use it, it's very simple:

  • ``getFeatures(paging = TRUE, ....)
  • you can modify the paging_length, default set to 1000 for now (this is likely to be changed): getFeatures(paging = TRUE, paging_length = 10, ... )

I'm also adding support to run this WFS paging as parallel, but code still needs consolidation, I'll let you know