knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(hillr)
To get a list of sites available from the endpoint
sites <- getHilltopSites(endpoint = "https://data.hbrc.govt.nz/Envirodata/EMARDiscrete.hts?")
To get a list of measurements at a site
measurements <- getHilltopMeasurements(endpoint = "https://data.hbrc.govt.nz/Envirodata/EMARDiscrete.hts?", site = "Maraetotara Lagoon")
To get some data for a site you'll need to know the Hilltop server endpoint, site name, and measurement. The getHilltopData function does basic requests, but to request multiple sites and or measurements, and to get additional metadata you'll need to use the fullGetHilltopData function.
Generally the fullGetHilltopData function is the preferred option.
eColi <- getHilltopData(endpoint = "https://data.hbrc.govt.nz/Envirodata/EMARDiscrete.hts?", site = "Maraetotara Lagoon", measurement = "E. Coli", from = "1/1/2018", to = "1/10/2018")
To get all the metadata for a measurement, or to get data from multiple sites and measurements
data <- fullGetHilltopData(endpoint = "https://data.hbrc.govt.nz/Envirodata/EMARDiscrete.hts?", sites = c("Maraetotara Lagoon", "Ngaruroro River at Fernhill"), measurements = c("E. Coli", "Nitrate Nitrogen"), from = "1/1/2017", to = "1/10/2017", option = "WQ")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.