1

I am attempting to get some WFS 2.0 INSPIRE data from the Finnish meteorological institute into a table format of some kind. Is there any software which can easily grab the attribute data for the WFS features I request? Currently, I am just running the queries from the browser but I am not very familiar with XML so I am having difficulties parsing the resulting document (I'm using R) into a useable format. I need a significant amount of historical information which generally precludes doing this in excel, although I may have to do that if I can't figure out another way to do it. I've also tried to grab the geo features directly in QGIS with the WFS 2.0 plugin, but always seem to get a 'bad request' server response when attempting to execute a stored query. Is there a simple way to get the data from the XML document into a tabular format, or a way to parametrize my own query to get the data I need and nothing else?

If you are interested in trying the service, you need to register an API key which is free.

http://en.ilmatieteenlaitos.fi/open-data-manual-fmi-wfs-services

1

Got it working using the fmi package in R.

https://github.com/rOpenGov/fmi/blob/master/vignettes/fmi_tutorial.md

1

Try the fmi R package from rOpenGov. This is an example partly from their tutorial and ran for me just fine:

install.packages(c("devtools", "sp", "rgdal", "raster")) # if you haven't
library(devtools)
install_github("rOpenGov/rwfs")
install_github("rOpenGov/fmi")
library(fmi)
library(sp)

apiKey <- "ENTER YOUR API KEY HERE"

request <- FMIWFSRequest$new(apiKey=apiKey)
request$setParameters(request="getFeature", 
                  storedquery_id="fmi::observations::weather::daily::timevaluepair",
                  starttime="2014-01-01T00:00:00Z",
                  endtime="2014-01-01T00:00:00Z",
                  bbox="19.09,59.3,31.59,70.13",
                  parameters="rrday,snow,tday,tmin,tmax")

client <- FMIWFSClient$new(request=request)
layers <- client$listLayers()
response <- client$getLayer(layer=layers[1], crs="+proj=longlat +datum=WGS84", swapAxisOrder=TRUE, parameters=list(splitListFields=TRUE))

names(response) # list attributes
[1] "fid"                                                    
[2] "gml_id"                                                 
[3] "beginPosition"                                          
[4] "endPosition"                                            
[5] "timePosition"                                           
[6] "value"                                                  
[7] "identifier"                                             
[8] "name1"                                                  
[9] "name2"                                                  
[10] "name3"                                                  
[11] "region"                                                 
[12] "time"                                                   
[13] "result_MeasurementTimeseries_point_MeasurementTVP_value"

# table with coordinates and attributes
mytable <- (cbind(coordinates(response), (response@data[-2])))

head(mytable)
  coords.x2 coords.x1                          fid        beginPosition....
1  19.90344  60.12475 PointTimeSeriesObservation.0 2014-01-01T00:00:00Z
2....
  • Hi. Thanks for the reply. I did find the package and have been getting it to work. It is unfortunate they don't mention this on their website, but somehow I stumbled across the package on a Google search – Erik Jun 20 '15 at 11:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.