I am pulling WFS data into R and using
gdalUtils::ogrinfo to look at the available layer names on a WFS server. Using the same url in QGIS, this is very fast and gives complete information. With
gdalUtils::ogrinfo, either I get an error, or it is very slow.
This url works fine in QGIS (note: you will have to get your own Key and replace
<YourKey> if you want test it)
The following code in R:
keyLINZ <- "<YourKey>" dsnLINZ <- paste0("https://data.linz.govt.nz/services;key=", keyLINZ,"/wfs?") ogrinfo(dsnLINZ, ro = TRUE, so = TRUE, verbose = TRUE)
Gives the following error:
 "ERROR 4: Failed to read GeoJSON data"  "FAILURE:"  "Unable to open datasource `https://data.linz.govt.nz/services;key=<YourKey>/wfs?' with the following drivers." ... list of all GDAL drivers ... attr(,"status")  1 Warning message: running command '"C:\OSGeo4W64\bin\ogrinfo.exe" -ro -so "https://data.linz.govt.nz/services;key=<YourKey>/wfs?" ' had status 1
It still does not work by adding
request=GetCapabilities to the end of the url (like other WFS urls that work).
However, it does work by adding
SERVICE=WFS&REQUEST=GetCapabilities to the end of the url. But, it takes a very long time to list the layers. Also, it only lists the layer number and feature type (polygon, point, line). None of the other information that QGIS lists (Title, layer Name, Abstract, coordinate system) are listed, even with the
q = TRUE option set.
How can I get the WFS information from the server in R similar to the info in QGIS and at the same speed?