-
Notifications
You must be signed in to change notification settings - Fork 301
Closed
Description
I'm trying to read GML data using st_read()
, which is causing an error.
library(sf)
library(rgdal)
# Define a query URL to Finnish Meteorological Institute WFS. The response
# contains data from 22 weather stations in Southern Finland within a single day.
# Data is not tidy. The URL below uses a personal API-key I'll delete later on.
> wfs_url <- 'http://data.fmi.fi/fmi-apikey/0253711c-056f-439b-af9d-a5a3a2920faf/wfs?request=getFeature&storedquery_id=fmi::observations::weather::daily::timevaluepair&starttime=2014-01-01&endtime=2014-01-01&bbox=23.5,59.7,26.5,60.7¶meters=tday'
# Download as a local file
> fmi_gml_file <- "fmi_test.gml"
> download.file(wfs_url, fmi_gml_file)
Reading fails with st_read()
:
> sf_dat <- sf::read_sf(fmi_gml_file)
Error in CPL_read_ogr(dsn, layer, as.character(options), quiet, type, :
Unrecognized field type
Reading with rgdal::readOGR()
works:
> ogr_dat <- rgdal::readOGR(fmi_gml_file)
OGR data source with driver: GML
Source: "fmi_test.gml", layer: "PointTimeSeriesObservation"
with 22 features
It has 10 fields, of which 1 list fields
The 1 list field could be the culprit:
> rgdal::ogrInfo(fmi_gml_file)
Source: "fmi_test.gml", layer: "PointTimeSeriesObservation"
Driver: GML; number of rows: 22
Feature type: wkbPoint with 2 dimensions
Extent: (23.57309 59.82076) - (26.44457 60.64668)
CRS: +proj=longlat +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +no_defs
Number of fields: 10
Number of list fields: 1
name type length typeName maxListCount
1 gml_id 4 0 String 0
2 beginPosition 4 20 String 0
3 endPosition 4 20 String 0
4 timePosition 4 20 String 0
5 value 4 31 String 0
6 identifier 0 0 Integer 0
7 name 5 0 StringList 3
8 region 4 11 String 0
9 time 4 20 String 0
10 result|MeasurementTimeseries|point|MeasurementTVP|value 2 0 Real 0
Field name
is of type stringList
, which have been supported since OGR 1.8.0. Perhaps there's some low-level, GML-driver specific missing in sf
which is causing st_read()
to trip over?
Metadata
Metadata
Assignees
Labels
No labels