if (FALSE) { # interactive()
# using a (generous) bounding box for Melbourne, Vic using only the SILO API
# for BOM stations, so no API key is needed.
bbox <- find_stations_in(
x = c(144.470215, -38.160476, 145.612793, -37.622934),
which_api = "SILO",
include_closed = TRUE
)
bbox
# Use the same bounding box but only find a single station nearest
# the centroid using only the SILO API for BOM stations
centroid <- find_stations_in(
x = c(144.470215, -38.160476, 145.612793, -37.622934),
which_api = "SILO",
include_closed = TRUE,
centroid = TRUE
)
centroid
# Use the `south_west_agricultural_region` data to fetch stations only in the
# south-western portion of WA and plot it with {ggplot2} showing open/closed
# stations just to be sure they're inside the area of interest.
# As this is in WA, we can use the DPIRD network, so we need our API key.
# Using the `south_west_agricultural_region` {sf} object provided.
sw_wa <- find_stations_in(
x = south_west_agricultural_region,
api_key = "your_api_key",
include_closed = TRUE
)
sw_wa
}
Run the code above in your browser using DataLab