I want to use a function mapunit_geom_by_ll_bbox from soilDB package in R which is supposed to download a GML file containing from the web, and read the GML using readOGR to return me an SpatialPolygonsDataFrame (i think) object. Although the function downloads the GML file successfully, it fails during readOGR step, and gives me an error:
Specifically, the code reads:
library(soilDB)
library(rgdal)
mapunit_geom_by_ll_bbox( c(-120.54,38.61,-120.41,38.70) )
and the error (with other messages) thrown is:
trying URL 'https://sdmdataaccess.nrcs.usda.gov/Spatial/SDMNAD83Geographic.wfs?Service=WFS&Version=1.0.0&Request=GetFeature&Typename=MapunitPoly&BBOX=-120.54,38.61,-120.41,38.7'
Content type 'text/xml; charset=utf-8' length 1547808 bytes (1.5 MB)
==================================================
downloaded 1.5 MB
Error in ogrInfo(dsn = dsn, layer = layer, encoding = encoding, use_iconv = use_iconv, :
Cannot open file
This error was thrown in the Centos 6.6 machine, but when tried in Windows, it runs successfully. Also, "GML" %in% rgdal::ogrDrivers()$name
returns TRUE, so there is GML driver in the machine.
I would love to know why the issue exist. Can someone please guide me?