Thanks to visit codestin.com
Credit goes to github.com

Skip to content
/ hilbert Public

❗ This is a read-only mirror of the CRAN R package repository. hilbert — Coordinate Indexing on Hilbert Curves. Homepage: https://hilbert.justinsingh.mehttps://github.com/program--/hilbert Report bugs for this package: https://github.com/program--/hilbert/issues

License

Notifications You must be signed in to change notification settings

cran/hilbert

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hilbert

CRAN status Codecov test coverage R-CMD-check MIT License

hilbert provides utilities for quick indexing/encoding of coordinates to a Hilbert Curve.

Installation

You can install hilbert via either remotes or pak:

# pak
pak::pkg_install("program--/hilbert")

# remotes
remotes::install_github("program--/hilbert")

Example

Setting Up

x <- -77.85641
y <- 34.35935
n <- 24 # n > 15 requires `bit64`
e <- c(xmax = 180, xmin = -180, ymax = 90, ymin = -90)

Coordinates to Position

pos <- hilbert::coords_to_position(x, y, n = n, extent = e)
pos
#>         x        y
#> 1 4760236 11591131

Position to Index

index <- hilbert::index(pos, coords = c("x", "y"), n = n, attach = TRUE)
index
#>         x        y               h
#> 1 4760236 11591131 129470580596149

Index to Position

new_pos <- hilbert::position(index, idx = "h", n = n, attach = FALSE)
new_pos
#>         x        y
#> 1 4760236 11591131

Position to Coordinates

new_xy <- hilbert::position_to_coords(new_pos, coords = c("x", "y"), extent = e, n = n, attach = TRUE)
new_xy
#>           x        y
#> 1 -77.85641 34.35935

About

❗ This is a read-only mirror of the CRAN R package repository. hilbert — Coordinate Indexing on Hilbert Curves. Homepage: https://hilbert.justinsingh.mehttps://github.com/program--/hilbert Report bugs for this package: https://github.com/program--/hilbert/issues

Resources

License

Stars

Watchers

Forks

Packages

No packages published