Extracts the station/location information from the XML files.

get_station_information(doc)

Arguments

doc

an XMLInternalDocument object as returned by xmlParse (XML package).

Value

Returns a SpatialPointsDataFrame object with station location information (the coordinates), name and description of the location plus the altitude of the location.

See also

get_station_information, get_meta_info, get_datetime.

Examples

# Latest L-type DWD MOSMIX forecast file for Innsbruck Airport url <- "https://opendata.dwd.de/weather/local_forecasts/mos/MOSMIX_L/single_stations/11120/kml/MOSMIX_L_LATEST_11120.kmz" # Download and extract file kmz <- tempfile("mosmix_demo_", fileext = ".kmz") check <- download.file(url, kmz) if ( inherits(check, "try-error") ) stop("Problems downloading the file!") kml <- unzip(kmz) # Parsing the unzipped kml file (XML format) doc <- XML::xmlParse(kml) # Extracting station information # NOTE that, for this example, we are downloading the latest forecasts # for one station (Innsbruck, 11120). Thus, the station information # returned by get_station_information will also only contain this # one station. stations <- get_station_information(doc) print(stations)
#> coordinates name desc alt #> 1 (11.35, 47.27) 11120 INNSBRUCK FL. 581
# Remove kmz and kml file file.remove(kmz, kml)
#> [1] TRUE TRUE