sf (version 0.5-2)

st_geohash: compute geohash from (average) coordinates (requires lwgeom)

Description

compute geohash from (average) coordinates (requires lwgeom)

Usage

st_geohash(x, precision = 0)

Arguments

x

object of class sf, sfc or sfg

precision

integer; precision (length) of geohash returned; when omitted, precision 10 is taken.

Value

character vector with geohashes

Details

see http://geohash.org/ or https://en.wikipedia.org/wiki/Geohash. in case a geometry contains more than one point, the geohash for the average of the points in the geometry is returned.

Examples

Run this code
# NOT RUN {
if (!is.na(sf_extSoftVersion()["lwgeom"])) {
 st_geohash(st_sfc(st_point(c(1.5,3.5)), st_point(c(0,90))), 2)
 st_geohash(st_sfc(st_point(c(1.5,3.5)), st_point(c(0,90))), 10)
}
# }

Run the code above in your browser using DataCamp Workspace