% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/createLocationMask.R
\name{createLocationMask}
\alias{createLocationMask}
\title{Create a mask of valid locations}
\usage{
createLocationMask(
  longitude = NULL,
  latitude = NULL,
  lonRange = c(-180, 180),
  latRange = c(-90, 90),
  removeZeroZero = TRUE
)
}
\arguments{
\item{longitude}{Vector of longitudes in decimal degrees east.}

\item{latitude}{Vector of latitudes in decimal degrees north.}

\item{lonRange}{Range of valid longitudes.}

\item{latRange}{Range of valid latitudes.}

\item{removeZeroZero}{Logical specifying whether the coordinate pair
\verb{(0, 0)} should be treated as invalid.}
}
\value{
Logical vector identifying valid locations.
}
\description{
Create a logical mask identifying valid longitude/latitude pairs.
}
\details{
The returned logical vector contains \code{TRUE} for valid locations and \code{FALSE}
for invalid locations. This is useful for filtering data frames to retain
only records with valid geographic coordinates.

Longitude and latitude values are considered valid when they:

\itemize{
\item fall within \code{lonRange} and \code{latRange}
\item are not missing
\item are not located at \verb{(0, 0)} when \code{removeZeroZero = TRUE}
}

The \code{lonRange} and \code{latRange} arguments can be used to restrict valid
locations to a rectangular geographic region.
}
\examples{
createLocationMask(
  longitude = c(-120, NA, -120, -220, -120, 0),
  latitude = c(45, 45, NA, 45, 100, 0)
)

createLocationMask(
  longitude = -120:-90,
  latitude = 20:50,
  lonRange = c(-110, -100),
  latRange = c(30, 40)
)

}
