knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
hilbert provides utilities for quick indexing/encoding of coordinates to a Hilbert Curve.
You can install hilbert via either remotes
or pak
:
# pak pak::pkg_install("program--/hilbert") # remotes remotes::install_github("program--/hilbert")
x <- -77.85641 y <- 34.35935 n <- 24 # n > 15 requires `bit64` e <- c(xmax = 180, xmin = -180, ymax = 90, ymin = -90)
pos <- hilbert::coords_to_position(x, y, n = n, extent = e) pos
index <- hilbert::index(pos, coords = c("x", "y"), n = n, attach = TRUE) index
new_pos <- hilbert::position(index, idx = "h", n = n, attach = FALSE) new_pos
new_xy <- hilbert::position_to_coords(new_pos, coords = c("x", "y"), extent = e, n = n, attach = TRUE) new_xy
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.