knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
You can do great things with SensorThings API. Any instance of SensorThings API can be interacted with using the same functions. For example, I have written a small R package (available at https://github.com/internetofwater/sta4R that provides commands that can be applied to any SensorThings API endpoint. For example, a function called sta_mapview()
that takes as an input the URL of any SensorThings API endpoint, and turns it into an interactive leaflet map. Below, I show how this function can be used to quickly create a map visualization of three separate SensorThings API endpoints (the one offered by NMBGMR, a proxy of the USGS National Groundwater Monitoring Network, and a proxy of the NMED instance of SDWIS/State)
#devtools::install_github("internetofwater/sta4R") library("sta4R") api_nmbgmr <- "https://st.newmexicowaterdata.org/FROST-Server/v1.1" api_usgs <- "https://sta-demo.internetofwater.dev/api/v1.1" api_nmed <- "https://e-enterprise-test.apigee.net/sdwis/sta/v1.0" plot <- sta_mapview(api_usgs,col.regions="green", layer.name="National Groundwater Monitoring Network") + sta_mapview(api_nmbgmr, col.regions="red", layer.name="New Mexico Bureau of Geology and Mineral Resources") + sta_mapview(api_nmed, col.regions="orange", layer.name="NMED SDWIS", cex=3) leaflet::setView(plot@map,-106,34.6, zoom=7)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.