-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
Develop
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
Package: h3 | ||
Title: R bindings for H3 | ||
Version: 3.3.0 | ||
Date: 2019-02-17 | ||
Version: 3.3.1 | ||
Date: 2019-03-08 | ||
Authors@R: person("Stefan","Kuethe", role = c("aut", "cre"), email = "[email protected]") | ||
Maintainer: Stefan Kuethe <[email protected]> | ||
Description: Provides R bindings for H3 <https://uber.github.io/h3/>, | ||
|
@@ -26,5 +26,5 @@ Suggests: | |
rmarkdown, | ||
leaflet, | ||
dplyr | ||
RoxygenNote: 6.1.0 | ||
RoxygenNote: 6.1.1 | ||
VignetteBuilder: knitr |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#' Parse edge coordiantes to \code{sf} object | ||
#' @param latlng matrix (2x2); edge coordinates | ||
#' @export | ||
edge_boundary_to_sf <- function(latlng) { | ||
sf::st_linestring(latlng[, 2:1]) %>% | ||
sf::st_sfc(crs = 4326) %>% | ||
sf::st_sf() | ||
} | ||
|
||
#' Get the unidirectional edge as \code{sf} object. | ||
#' @inheritParams get_h3_unidirectional_edge_boundary | ||
#' @export | ||
get_h3_unidirectional_edge_boundary_sf <- function(h3_edge_index) { | ||
get_h3_unidirectional_edge_boundary(h3_edge_index) %>% | ||
edge_boundary_to_sf() | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#' Get the coordinates defining the unidirectional edge. | ||
#' @param h3_edge_index character scalar; H3 edge index | ||
#' @export | ||
get_h3_unidirectional_edge_boundary <- function(h3_edge_index) { | ||
rcpp_get_h3_unidirectional_edge_boundary(h3_edge_index) | ||
} | ||
|
||
#' Get all of the unidirectional edges from the given H3 index. | ||
#' @param h3_index character scalar; H3 index | ||
#' @example inst/examples/api-reference/get-h3-unidirectional-edges-from-hexagon.R | ||
#' @export | ||
get_h3_unidirectional_edges_from_hexagon <- function(h3_index) { | ||
rcpp_get_h3_unidirectional_edges_from_hexagon(h3_index) | ||
} | ||
|
||
#' Get the origin hexagon from the unidirectional H3 edge index. | ||
#' @inheritParams get_h3_unidirectional_edge_boundary | ||
#' @export | ||
get_origin_h3_index_from_unidirectional_edge <- function(h3_edge_index) { | ||
rcpp_get_origin_h3_index_from_unidirectional_edge(h3_edge_index) | ||
} | ||
|
||
#' Get the destination hexagon from the unidirectional H3 edge index. | ||
#' @inheritParams get_h3_unidirectional_edge_boundary | ||
#' @export | ||
get_destination_h3_index_from_unidirectional_edge <- function(h3_edge_index) { | ||
rcpp_get_destination_h3_index_from_unidirectional_edge(h3_edge_index) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
edges <- road_safety_greater_manchester[1, ] %>% | ||
geo_to_h3() %>% | ||
get_h3_unidirectional_edges_from_hexagon() | ||
|
||
h3_unidirectional_edge_is_valid(edges) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
h3_index <- road_safety_greater_manchester[1, ] %>% | ||
geo_to_h3() | ||
|
||
edges <- get_h3_unidirectional_edges_from_hexagon(h3_index) | ||
get_origin_h3_index_from_unidirectional_edge(edges[1]) == h3_index |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.