% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/createLocationID.R
\name{createLocationID}
\alias{createLocationID}
\title{Create one or more unique location IDs}
\usage{
createLocationID(
  longitude = NULL,
  latitude = NULL,
  precision = 10,
  algorithm = c("geohash", "digest"),
  invalidID = as.character(NA)
)
}
\arguments{
\item{longitude}{Vector of longitudes in decimal degrees east.}

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

\item{precision}{Precision used when encoding geohashes.}

\item{algorithm}{Encoding algorithm to use. Only \code{"geohash"} is currently
supported. \code{"digest"} is deprecated and will generate an error.}

\item{invalidID}{Identifier to use for invalid locations. This can be a
character string or \code{NA}.}
}
\value{
Character vector of location IDs.
}
\description{
Create a location ID for each longitude/latitude pair using a geohash.
}
\details{
Each location ID is unique within a geohash grid cell. The \code{precision}
argument determines the size of the grid cell. At the equator, approximate
grid cell widths are:

\preformatted{
precision   maximum grid cell width
        5   ~ 4.9 km
        6   ~ 1.2 km
        7   ~ 153 m
        8   ~ 38 m
        9   ~ 4.8 m
       10   ~ 1.2 m
}

Invalid locations are assigned the value specified by \code{invalidID}, typically
\code{NA}.
}
\examples{
longitude <- c(-122.5, 0, NA, -122.5, -122.5)
latitude <- c(47.5, 0, 47.5, NA, 47.5)

createLocationID(longitude, latitude)
createLocationID(longitude, latitude, precision = 7)
createLocationID(longitude, latitude, invalidID = "bad")

}
\references{
\url{https://michaelchirico.github.io/geohashTools/index.html}
}
