gh_encode: Encode Latitude and Longitude Values

Description Usage Arguments Value See Also Examples

View source: R/RcppExports.R

Description

gh_encode generates geohashes of a given precision from vectors of latitude and longitude values.

Usage

1
gh_encode(lats, lngs, precision = 6L)

Arguments

lats

a numeric vector of latitude values.

lngs

a numeric vector of longitude values. Must be the same length as lat.

precision

an integer representing the precision the hashes should have. This should be between 1 and 10; if the precision requested is greater than 10, it will use 10 - if less than 1, it will error.

Value

a character vector of hashes, the same length as lat and lng, with NA values where one of the equivalent lat/lng pair was NA.

See Also

gh_decode, for taking geohashes and turning them back into coordinates, and gh_neighbours for retrieving the neighbouring hashes to a particular hash.

Examples

1
2
3
# A simple example:
gh_encode(lat = 42.60498046875, lng = -5.60302734375, precision = 5)
#[1] "ezs42"

geohash documentation built on Aug. 2, 2017, 5:01 p.m.