Learn R Programming

AirMonitor (version 0.4.2)

monitor_getDistance: Calculate distances from mts_monitor locations to a location of interest

Description

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.

Usage

monitor_getDistance(
  monitor = NULL,
  longitude = NULL,
  latitude = NULL,
  measure = c("geodesic", "haversine", "vincenty", "cheap")
)

Value

Named vector of distances (meters) with each distance identified by deviceDeploymentID.

Arguments

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

Examples

Run this code
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])

Run the code above in your browser using DataLab