Skip to content

Instantly share code, notes, and snippets.

@FrieseWoudloper
Created July 31, 2018 19:50
Show Gist options
  • Save FrieseWoudloper/dd76c5877819a2fcbe4e94da7b05eef3 to your computer and use it in GitHub Desktop.
Save FrieseWoudloper/dd76c5877819a2fcbe4e94da7b05eef3 to your computer and use it in GitHub Desktop.
Parse WFS response in R
install.packages("XML")
library(XML)
doc <- xmlParse("http://geodata.nationaalgeoregister.nl/cbsgebiedsindelingen/wfs?request=GetCapabilities", isURL = TRUE)
output_formats <- unlist(xpathApply(doc, "//ows:Operation[@name='GetFeature']/ows:Parameter[@name='outputFormat']/ows:AllowedValues/ows:Value/text()", xmlValue))
print(output_formats)
feature_types <- unlist(xpathApply(doc,"//wfs:FeatureType/wfs:Name/text()", xmlValue))
head(feature_types)
# The server limit
max_per_request <- as.integer(unlist(xpathApply(doc,"//ows:Constraint[@name='CountDefault']/ows:DefaultValue/text()", xmlValue)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment