rwfs
rwfs copied to clipboard
Improve error reporting in WFSClient$getLayer or deal with empty / missing layers in some other fashion
For original context see fmi/issues/22.
When trying to download weather data from FMI for a period or station where they don't exist, the FMIWFSClient$getDailyWeather
get fails with an error in convertOGR. It would be preferable to have more descriptive error message or an empty dataset to be returned. The relevant rwfs
code is in the WFSClient$getLayer
method.
> client$getDailyWeather(startDateTime="2012-05-15", endDateTime="2012-07-17", fmisid = 100929)
ogr2ogr -f GML -splitlistfields /tmp/Rtmp9R6Bi7/file470e214c4ed /tmp/Rtmp9R6Bi7/file470e50047a05 PointTimeSeriesObservation
ERROR 1: Couldn't fetch requested layer 'PointTimeSeriesObservation'!
Error in convertOGR(sourceFile = private$cachedResponseFile, layer = layer, :
Conversion failed.
On the rwfs
develop
branch the error is still not very informative.
Error in ogrInfo(dsn = dsn, layer = layer, encoding = encoding, use_iconv = use_iconv, :
Cannot open layer
Error in private$.getLayer(dataSource = sourceFile, layer = layer, crs = crs, :
Fatal error.
A shortened version of the empty response:
<?xml version="1.0" encoding="UTF-8"?>
<wfs:FeatureCollection
timeStamp="2016-11-28T10:54:03Z"
numberMatched="0"
numberReturned="0"
xmlns:wfs="...">
</wfs:FeatureCollection>