View source: R/monitor_getDistance.R
monitor_getDistance | R Documentation |
This function returns the distances (meters) between monitor
locations
and a location of interest. These distances can be used to create a
mask identifying monitors within a certain radius of the location of interest.
monitor_getDistance(
monitor = NULL,
longitude = NULL,
latitude = NULL,
measure = c("geodesic", "haversine", "vincenty", "cheap")
)
monitor |
mts_monitor object. |
longitude |
Longitude of the location of interest. |
latitude |
Latitude of the location of interest. |
measure |
One of "geodesic", "haversine" "vincenty", or "cheap". |
Named vector of distances (meters) with each distance identified
by deviceDeploymentID
.
The measure "cheap"
may be used to speed things up depending on
the spatial scale being considered. Distances calculated with
measure = "cheap"
will vary by a few meters compared with those
calculated using measure = "geodesic"
.
library(AirMonitor)
# Walla Walla
longitude <- -118.3302
latitude <- 46.065
distance <- monitor_getDistance(NW_Megafires, longitude, latitude)
closestIndex <- which(distance == min(distance))
# Distance in meters
distance[closestIndex]
# Monitor core metadata
str(NW_Megafires$meta[closestIndex, AirMonitor::coreMetadataNames])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.