support st_geohash directly parse polygon
harryprince opened this issue · 2 comments
harryprince commented
I am using st_geohash to parse a sf polygon data frame into geohash list, however, I found it fail to convert polygons to geohash list directly.
edzer commented
Could you please give a reproducible example?
harryprince commented
sorry, I found an alternative way:
s_df %>%
sf::st_make_grid(cellsize = .00001) %>%
sf::st_intersection(s_df) %>%
lwgeom::st_geohash(9)
it seems can wrap as a function like this:
geometry2geohash <- function(geometry){
geometry %>%
sf::st_make_grid(cellsize = .0001) %>%
sf::st_intersection(geometry) %>%
lwgeom::st_geohash(9)
}