Description Usage Arguments Value Examples
View source: R/monitor_writeCurrentStatusGeoJSON.R
Writes a geoJSON file containing current monitor data. For details on what is
included, see monitor_getCurrentStatus
.
1 2 3 4 5 6 7 8 | monitor_writeCurrentStatusGeoJSON(
ws_monitor,
filename,
datetime = lubridate::now(tzone = "UTC"),
properties = NULL,
propertyNames = NULL,
metadataList = list()
)
|
ws_monitor |
ws_monitor object. |
filename |
Filename where geojson file will be saved. |
datetime |
Time to which data will be 'current' (integer or character
representing YYYYMMDDHH or |
properties |
Optional character vector of properties to include for each
monitor in geoJSON. If NULL all are included. May include any ws_monitor
metadata and additional columns generated in
|
propertyNames |
Optional character vector supplying custom names for
properties in geoJSON. If NULL or different length than |
metadataList |
List of top-level foreign members to include. May include
nested lists as long as they can be converted into JSON using
|
Invisibly returns geoJSON string.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # Fail gracefully if any resources are not available
try({
library(PWFSLSmoke)
wa <-
monitor_loadLatest() %>%
monitor_subset(stateCodes = "WA")
geojson_file <- tempfile(fileext = ".geojson")
wa_current_geojson <- monitor_writeCurrentStatusGeoJSON(wa, geojson_file)
wa_current_list <- jsonlite::fromJSON(wa_current_geojson)
wa_spdf <- rgdal::readOGR(dsn = geojson_file)
map("state", "washington")
points(wa_spdf)
}, silent = FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.