if (FALSE) {
   #example based on a WFS endpoint responding at http://localhost:8080/geoserver/wfs
   wfs <- WFSClient$new("http://localhost:8080/geoserver/wfs", serviceVersion = "1.1.1")
   
   #get capabilities
   caps <- wfs$getCapabilities()
   
   #find feature type
   ft <- caps$findFeatureTypeByName("mylayer")
   if(length(ft)>0){
     data <- ft$getFeatures()
     data_with_filter <- ft$getFeatures(cql_filter = "somefilter")
   }
   
   #Advanced examples at https://github.com/eblondel/ows4R/wiki#wfs
}
Run the code above in your browser using DataLab