knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(hillr)

List of Sites

To get a list of sites available from the endpoint

sites <- getHilltopSites(endpoint = "https://data.hbrc.govt.nz/Envirodata/EMARDiscrete.hts?")

Measurements At A Site

To get a list of measurements at a site

measurements <- getHilltopMeasurements(endpoint = "https://data.hbrc.govt.nz/Envirodata/EMARDiscrete.hts?",
                                                   site = "Maraetotara Lagoon")

Data

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.

Discrete (Sample Data)

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")


jeffcnz/hillr documentation built on Nov. 21, 2024, 11:58 p.m.