Learn R Programming

MazamaTimeSeries (version 0.3.0)

mts_getDistance: Calculate distances from mts time series locations to a location of interest

Description

This function uses the [geodist] package to return the distances (meters) between mts 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

mts_getDistance(
  mts = NULL,
  longitude = NULL,
  latitude = NULL,
  measure = c("geodesic", "haversine", "vincenty", "cheap")
)

Value

Vector of of distances (meters) named by deviceDeploymentID.

Arguments

mts

mts 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(MazamaTimeSeries)

# Garfield Medical Center in LA
longitude <- -118.12321
latitude <- 34.06775

distances <- mts_getDistance(
  mts = example_mts,
  longitude = longitude,
  latitude = latitude
)

# Which sensors are within 1000 meters of Garfield Med Ctr?
distances[distances <= 1000]

Run the code above in your browser using DataLab