Buurt boundaries incomplete

I was downloading the buurt geometries using this R script:

list_of_geos <- c("landsdeel", "buurt")

## loop through main geometries

for (geo_nam in list_of_geos){
  
  ## define url
  url <- parse_url("https://service.pdok.nl/cbs/gebiedsindelingen/2023/wfs/v1_0")
  ## build request
  url$query <- list(service = "WFS",
                    version = "2.0.0",
                    request = "GetFeature",
                    typename = paste0("gebiedsindelingen:", geo_nam,  "_gegeneraliseerd"),
                    outputFormat = "application/json")
  request <- build_url(url)
  ## request shapes
  geo_sf <- st_read(request, quiet = TRUE)
  ## assign environment name
  assign(geo_nam, geo_sf)
  
}

landsdeel and others seem to work fine, but the buurt is missing most of the country.

Any thoughts?

All WFS services have a limit to the number of features returned in a single request. Your screenshot clearly indicates that that is what you are encountering to me.

So either you have to use pagination, or you can use the Downloadservice, which will give you a geopackage for the year of your choice (from 2016 onwards).

HTH,
Stefan

3 likes

Thanks! I didn’t realise this. Do you have a link or example of what the pagination solution would look like?

The limit @sbjager is refering can be seen in the (default) XML/GML response of the WFS when you call https://service.pdok.nl/cbs/gebiedsindelingen/2023/wfs/v1_0?service=WFS&version=2.0.0&request=GetFeature&typename=gebiedsindeling:buurt_gegeneraliseerd for example. You will see these parametes "numberReturn", but also the "next" URL to call the next 1000 features.

(This isn’t shown/visible in the outputformat=application/json, because of missmatch in the spec of what is allow to be put into the JSON response )

In other words you need to read the value (URL) in the "next" parameter until there isn’t one to read anymore.

3 likes