Title: | Hexagonal Hierarchical Geospatial Indexing System |
---|---|
Description: | Provides access to Uber's 'H3' geospatial indexing system via 'h3lib' <https://CRAN.R-project.org/package=h3lib>. 'h3r' is designed to mimic the 'H3' Application Programming Interface (API) <https://h3geo.org/docs/api/indexing/>, so that any function in the API is also available in 'h3r'. |
Authors: | David Cooley [aut, cre], Ray Shao [aut] |
Maintainer: | David Cooley <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.2 |
Built: | 2025-02-11 02:40:30 UTC |
Source: | https://github.com/symbolixau/h3r |
Returns whether or not the provided H3 cell indexes are neighbors
areNeighborCells(origin, destination)
areNeighborCells(origin, destination)
origin |
vector of origin H3 cell indexes |
destination |
vector of destination H3 cell indexes |
1 if the indexes are neighbors, 0 otherwise.
areNeighborCells( origin = c("85283473fffffff","85283473fffffff") , destination = c("85283471fffffff","85283477fffffff") )
areNeighborCells( origin = c("85283473fffffff","85283473fffffff") , destination = c("85283471fffffff","85283477fffffff") )
Exact area of specific cell in square kilometers.
cellAreaKm2(cell)
cellAreaKm2(cell)
cell |
vector of H3 cells |
the exact area of specific cell in square kilometers.
cellAreaKm2(cell = c("8cbe63562a54bff","8cbe635631103ff"))
cellAreaKm2(cell = c("8cbe63562a54bff","8cbe635631103ff"))
Exact area of specific cell in square meters.
cellAreaM2(cell)
cellAreaM2(cell)
cell |
vector of H3 cells |
the exact area of specific cell in square meters.
cellAreaM2(cell = c("8cbe63562a54bff","8cbe635631103ff"))
cellAreaM2(cell = c("8cbe63562a54bff","8cbe635631103ff"))
Exact area of specific cell in square radians.
cellAreaRads2(cell)
cellAreaRads2(cell)
cell |
vector of H3 cells |
the exact area of specific cell in square radians.
cellAreaRads2(cell = c("8cbe63562a54bff","8cbe635631103ff"))
cellAreaRads2(cell = c("8cbe63562a54bff","8cbe635631103ff"))
Returns a unidirectional edge H3 index based on the provided origin and destination.
cellsToDirectedEdge(origin, destination)
cellsToDirectedEdge(origin, destination)
origin |
vector of origin H3 cell indexes |
destination |
vector of destination H3 cell indexes |
a unidirectional edge H3 index based on the provided origin and destination.
cellsToDirectedEdge( origin = c("85283471fffffff","85283473fffffff") , destination = c("85283475fffffff","85283477fffffff") )
cellsToDirectedEdge( origin = c("85283471fffffff","85283473fffffff") , destination = c("85283475fffffff","85283477fffffff") )
Cell To Boundary
cellToBoundary(cell)
cellToBoundary(cell)
cell |
vector of H3 cells |
named list, each element named with the input H3 cell, and containing
a lat
and lng
vector
cellToBoundary(cell = c("8cbe63562a54bff","8cbe635631103ff"))
cellToBoundary(cell = c("8cbe63562a54bff","8cbe635631103ff"))
cell
at the childRes
resolutionProvies the center child index contained by cell
at the childRes
resolution
cellToCenterChild(cell, childRes)
cellToCenterChild(cell, childRes)
cell |
vector of H3 cells |
childRes |
integer vector specifying the child resolution for each
|
index of the child cells
cellToCenterChild( cell = c("85283473fffffff","85283473fffffff") , childRes = c(7L, 8L) )
cellToCenterChild( cell = c("85283473fffffff","85283473fffffff") , childRes = c(7L, 8L) )
Returns the position of the child cell within an ordered list of all children of the cell's parent at the specified resolution parentRes.
cellToChildPos(cell, parentRes)
cellToChildPos(cell, parentRes)
cell |
vector of H3 cells |
parentRes |
integer vector specifying the parent resolution for
each |
the position of the child cell
cellToChildPos( cell = c("8cbe63562a54bff","8cbe635631103ff") , parentRes = c(1L, 2L) )
cellToChildPos( cell = c("8cbe63562a54bff","8cbe635631103ff") , parentRes = c(1L, 2L) )
Returns all the H3 indexes contained by the input cell
at the defined
child resolution
cellToChildren(cell, childRes)
cellToChildren(cell, childRes)
cell |
vector of H3 cells |
childRes |
integer vector specifying the child resolution for each
|
a named list, where each element is the input cell
, and the values
of each element are the child H3 cells
cell <- "8cbe63562a54bff" currentResolution <- getResolution(cell = cell) cellToChildren(cell, childRes = currentResolution + 1L) cellToChildren(cell, childRes = currentResolution + 2L) res0 <- getRes0Cells() cellToChildren(res0[1], 1L) cellToChildren(res0[1], 2L) cellToChildren(res0[1:5], 1L:5L)
cell <- "8cbe63562a54bff" currentResolution <- getResolution(cell = cell) cellToChildren(cell, childRes = currentResolution + 1L) cellToChildren(cell, childRes = currentResolution + 2L) res0 <- getRes0Cells() cellToChildren(res0[1], 1L) cellToChildren(res0[1], 2L) cellToChildren(res0[1:5], 1L:5L)
Finds the center of the cell in grid space
cellToLatLng(cell)
cellToLatLng(cell)
cell |
vector of H3 cells |
a list of two vectors, lat
and lng
, each the same length as
cell
, giving the center of cell
cellToLatLng(cell = c("8cbe63562a54bff","8cbe635631103ff"))
cellToLatLng(cell = c("8cbe63562a54bff","8cbe635631103ff"))
Produces local IJ coordinates for an H3 index anchored by an origin.
cellToLocalIj(origin, cell)
cellToLocalIj(origin, cell)
origin |
vector of anchor cell |
cell |
vector of cell you input |
(i, j) coordinates
cellToLocalIj( origin = c("85283473fffffff","85283473fffffff") , cell = c("8528342bfffffff","85283477fffffff") )
cellToLocalIj( origin = c("85283473fffffff","85283473fffffff") , cell = c("8528342bfffffff","85283477fffffff") )
Provides the parent (coarser) index containing cell
cellToParent(cell, parentRes)
cellToParent(cell, parentRes)
cell |
vector of H3 cells |
parentRes |
integer vector specifying the parent resolution for each
|
vector of parent cells for each cell
cell <- "8cbe63562a54bff" getResolution(cell = cell) ## The `parentRes` should be a lower value than the result of `getResolution()` cellToParent(cell = rep(cell, 2), parentRes = c(11L, 10L)) ## Specifying a single resolution cells <- c("8cbe63562a54bff", "8cbe635631103ff") getResolution(cell = cells) cellToParent(cell = cells, parentRes = 6) cellToParent(cell = cells, parentRes = 7)
cell <- "8cbe63562a54bff" getResolution(cell = cell) ## The `parentRes` should be a lower value than the result of `getResolution()` cellToParent(cell = rep(cell, 2), parentRes = c(11L, 10L)) ## Specifying a single resolution cells <- c("8cbe63562a54bff", "8cbe635631103ff") getResolution(cell = cells) cellToParent(cell = cells, parentRes = 6) cellToParent(cell = cells, parentRes = 7)
Returns the index for the specified cell vertex. Valid vertex numbers are between 0 and 5 (inclusive) for hexagonal cells, and 0 and 4 (inclusive) for pentagonal cells.
cellToVertex(cell, vertexNum)
cellToVertex(cell, vertexNum)
cell |
vector of H3 cells |
vertexNum |
integer giving the vertex number of the index to return |
vector of vertex indexes
cellToVertex( cell = c(rep("8cbe63562a54bff", 6)) , vertexNum = c(0L:5L) )
cellToVertex( cell = c(rep("8cbe63562a54bff", 6)) , vertexNum = c(0L:5L) )
Returns the indexes for all vertices of the given cell
. The
Output will have a 0 in the result if the input cell
is a pentagon
cellToVertexes(cell)
cellToVertexes(cell)
cell |
vector of H3 cells |
list of vectors giving the vertices of each cell.
Each list element corresponds to the cell index given in the cell
argument,
and each element of the vector are the cell vertexes.
cellToVertexes(cell = c("8cbe63562a54bff", "8cbe635631103ff") )
cellToVertexes(cell = c("8cbe63562a54bff", "8cbe635631103ff") )
Returns the child cell at a given position within an ordered list of all children of parent at the specified resolution childRes.
childPosToCell(childPos, cell, childRes)
childPosToCell(childPos, cell, childRes)
childPos |
the position of the child cell |
cell |
vector of H3 cells |
childRes |
integer vector specifying the child resolution for each
|
the position of the child cell
childPosToCell( childPos = c(42, 41) , cell = c("85283473fffffff","85283473fffffff") , childRes = c(7L, 7L) )
childPosToCell( childPos = c(42, 41) , cell = c("85283473fffffff","85283473fffffff") , childRes = c(7L, 7L) )
Compacts the set cellSet of indexes as best as possible, into the array compactedSet.
compactCells(cellSet)
compactCells(cellSet)
cellSet |
list of character vectors containing to be compacted H3 cell indexes |
a list of character vectors containing the compacted H3 cell indexes
compactCells(gridDisk(cell = c("8cbe63562a54bff","8cbe635631103ff"), k = c(1L, 2L)))
compactCells(gridDisk(cell = c("8cbe63562a54bff","8cbe635631103ff"), k = c(1L, 2L)))
Converts Degrees to Radians
degsToRads(deg)
degsToRads(deg)
deg |
vector of degrees |
numeric vector giving the input deg
values as radians
degsToRads(deg = seq(0, 360, by = 15))
degsToRads(deg = seq(0, 360, by = 15))
Directed edge To Boundary
directedEdgeToBoundary(edge)
directedEdgeToBoundary(edge)
edge |
unidirectional edge |
named list, each element named with the input H3 cell, and containing
a lat
and lng
vector
directedEdgeToBoundary(edge = c("115283473fffffff","115283477fffffff"))
directedEdgeToBoundary(edge = c("115283473fffffff","115283477fffffff"))
Get the origin and destination cells of the unidirectional edge
directedEdgeToCells(edge)
directedEdgeToCells(edge)
edge |
vector of unidirectional edge H3 indexes |
the origin, destination pair of hexagon IDs for the given edge ID
directedEdgeToCells(edge = c("115283473fffffff","115283471fffffff"))
directedEdgeToCells(edge = c("115283473fffffff","115283471fffffff"))
Get the exact edge length of specific unidirectional edge in kilometers.
edgeLengthKm(edge)
edgeLengthKm(edge)
edge |
vector of unidirectional H3 edges |
the exact edge length of specific unidirectional edge in kilometers.
edgeLengthKm(edge = c("13d2a1672b34ffff","16a2a1072b59ffff"))
edgeLengthKm(edge = c("13d2a1672b34ffff","16a2a1072b59ffff"))
Get the exact edge length of specific unidirectional edge in meters.
edgeLengthM(edge)
edgeLengthM(edge)
edge |
vector of unidirectional H3 edges |
the exact edge length of specific unidirectional edge in meters.
edgeLengthM(edge = c("13d2a1672b34ffff","16a2a1072b59ffff"))
edgeLengthM(edge = c("13d2a1672b34ffff","16a2a1072b59ffff"))
Get the exact edge length of specific unidirectional edge in radians.
edgeLengthRads(edge)
edgeLengthRads(edge)
edge |
vector of unidirectional H3 edges |
the exact edge length of specific unidirectional edge in radians.
edgeLengthRads(edge = c("13d2a1672b34ffff","16a2a1072b59ffff"))
edgeLengthRads(edge = c("13d2a1672b34ffff","16a2a1072b59ffff"))
Returns the base cell number of the index
getBaseCellNumber(cell)
getBaseCellNumber(cell)
cell |
vector of H3 cells |
a vector the same length as cell
giving the base cell number of
each index
getBaseCellNumber(cell = c("8cbe63562a54bff","8cbe635631103ff"))
getBaseCellNumber(cell = c("8cbe63562a54bff","8cbe635631103ff"))
Get the destination cell of the unidirectional edge
getDirectedEdgeDestination(edge)
getDirectedEdgeDestination(edge)
edge |
vector of unidirectional edge H3 indexes |
the destination hexagon from the unidirectional edge H3Index.
getDirectedEdgeDestination(edge = c("115283473fffffff","16a2a1072b59ffff"))
getDirectedEdgeDestination(edge = c("115283473fffffff","16a2a1072b59ffff"))
Get the origin cell of the unidirectional edge
getDirectedEdgeOrigin(edge)
getDirectedEdgeOrigin(edge)
edge |
vector of unidirectional edge H3 indexes |
the origin hexagon from the unidirectional edge H3Index.
getDirectedEdgeOrigin((edge = c("115283473fffffff","16a2a1072b59ffff")))
getDirectedEdgeOrigin((edge = c("115283473fffffff","16a2a1072b59ffff")))
Get the average hexagon area in square kilometers at the given resolution. Excludes pentagons.
getHexagonAreaAvgKm2(resolution)
getHexagonAreaAvgKm2(resolution)
resolution |
cell resolution |
Average hexagon area in square kilometers at the given resolution. Excludes pentagons.
getHexagonAreaAvgKm2(resolution = c(12L,10L))
getHexagonAreaAvgKm2(resolution = c(12L,10L))
Get the average hexagon area in square meters at the given resolution. Excludes pentagons.
getHexagonAreaAvgM2(resolution)
getHexagonAreaAvgM2(resolution)
resolution |
cell resolution |
Average hexagon area in square meters at the given resolution. Excludes pentagons.
getHexagonAreaAvgM2(resolution = c(12L,10L))
getHexagonAreaAvgM2(resolution = c(12L,10L))
Get the average hexagon edge length in kilometers at the given resolution. Excludes pentagons.
getHexagonEdgeLengthAvgKm(resolution)
getHexagonEdgeLengthAvgKm(resolution)
resolution |
cell resolution |
Average hexagon edge length in kilometers at the given resolution. Excludes pentagons.
getHexagonEdgeLengthAvgKm(resolution = c(12L,10L))
getHexagonEdgeLengthAvgKm(resolution = c(12L,10L))
Get the average hexagon edge length in meters at the given resolution. Excludes pentagons.
getHexagonEdgeLengthAvgM(resolution)
getHexagonEdgeLengthAvgM(resolution)
resolution |
cell resolution |
Average hexagon edge length in meters at the given resolution. Excludes pentagons.
getHexagonEdgeLengthAvgM(resolution = c(12L,10L))
getHexagonEdgeLengthAvgM(resolution = c(12L,10L))
Find all icosahedron faces intersected by a given H3 index. Faces are represented as integers from 0-19, inclusive. The array is sparse, and empty (no intersection) array values are represented by -1.
getIcosahedronFaces(cell)
getIcosahedronFaces(cell)
cell |
vector of H3 cells |
list of vectors. Each list element corresponds to the input cell
values.
Each vector in a list element gives the faces intersected by the cell
getIcosahedronFaces(cell = c("8cbe63562a54bff","8cbe635631103ff")) getIcosahedronFaces(cell = cellToParent(c("8cbe63562a54bff" ,"8cbe635631103ff"), c(7L, 7L)))
getIcosahedronFaces(cell = c("8cbe63562a54bff","8cbe635631103ff")) getIcosahedronFaces(cell = cellToParent(c("8cbe63562a54bff" ,"8cbe635631103ff"), c(7L, 7L)))
Get the number of unique H3 indexes at the given resolution.
getNumCells(resolution)
getNumCells(resolution)
resolution |
cell resolution |
the number of unique H3 indexes at the given resolution
getNumCells(resolution = c(12L,10L))
getNumCells(resolution = c(12L,10L))
Get all the pentagon H3 indexes at the specified resolution.
getPentagons(resolution)
getPentagons(resolution)
resolution |
cell resolution |
all the pentagon H3 indexes at the specified resolution.
getPentagons(resolution = c(12L,10L))
getPentagons(resolution = c(12L,10L))
Get all the resolution 0 H3 indexes.
getRes0Cells()
getRes0Cells()
all the resolution 0 H3 indexes.
getRes0Cells()
getRes0Cells()
Returns the resolution of the index.
getResolution(cell)
getResolution(cell)
cell |
vector of H3 cells |
a vector the same length as cell
giving the resolution of each
index
getResolution(cell = c("8cbe63562a54bff","8cbe635631103ff"))
getResolution(cell = c("8cbe63562a54bff","8cbe635631103ff"))
Gives the "great circle" or "haversine" distance between pairs of lat/lng coordinates in kilometers.
greatCircleDistanceKm(aLat, aLng, bLat, bLng)
greatCircleDistanceKm(aLat, aLng, bLat, bLng)
aLat |
vector of latitude cooridnates (from) |
aLng |
vector of longitude coordinates (from) |
bLat |
vector of latitude coordinates (to) |
bLng |
vector of longitude coordinates (to) |
numeric vector giving the great circle distance in kilometres
greatCircleDistanceKm( aLat = c(-37.820197) , aLng = c(144.983324) , bLat = c(-37.818476) , bLng = c(144.967354) )
greatCircleDistanceKm( aLat = c(-37.820197) , aLng = c(144.983324) , bLat = c(-37.818476) , bLng = c(144.967354) )
Gives the "great circle" or "haversine" distance between pairs of lat/lng coordinates in meters.
greatCircleDistanceM(aLat, aLng, bLat, bLng)
greatCircleDistanceM(aLat, aLng, bLat, bLng)
aLat |
vector of latitude cooridnates (from) |
aLng |
vector of longitude coordinates (from) |
bLat |
vector of latitude coordinates (to) |
bLng |
vector of longitude coordinates (to) |
numeric vector giving the great circle distance in metres
greatCircleDistanceM( aLat = c(-37.820197) , aLng = c(144.983324) , bLat = c(-37.818476) , bLng = c(144.967354) )
greatCircleDistanceM( aLat = c(-37.820197) , aLng = c(144.983324) , bLat = c(-37.818476) , bLng = c(144.967354) )
Gives the "great circle" or "haversine" distance between pairs of lat/lng coordinates in radians
greatCircleDistanceRads(aLat, aLng, bLat, bLng)
greatCircleDistanceRads(aLat, aLng, bLat, bLng)
aLat |
vector of latitude cooridnates (from) |
aLng |
vector of longitude coordinates (from) |
bLat |
vector of latitude coordinates (to) |
bLng |
vector of longitude coordinates (to) |
numeric vector giving the great circle distance in radians
greatCircleDistanceRads( aLat = c(-37.820197) , aLng = c(144.983324) , bLat = c(-37.818476) , bLng = c(144.967354) )
greatCircleDistanceRads( aLat = c(-37.820197) , aLng = c(144.983324) , bLat = c(-37.818476) , bLng = c(144.967354) )
Get indices within k distance of the origin index.
gridDisk(cell, k)
gridDisk(cell, k)
cell |
vector of H3 cells |
k |
int distance |
Elements of the output array may be left as zero, which can happen when crossing a pentagon.
k-ring 0 is defined as the origin index, k-ring 1 is defined as k-ring 0 and all neighboring indexes, and so on.
the indices within k distance of the origin index
gridDisk(cell = c("8cbe63562a54bff","8cbe635631103ff"), k = c(1L, 2L))
gridDisk(cell = c("8cbe63562a54bff","8cbe635631103ff"), k = c(1L, 2L))
Get indices within k distance of the origin index.
gridDiskDistances(cell, k)
gridDiskDistances(cell, k)
cell |
vector of H3 cells |
k |
int distance |
k-ring 0 is defined as the origin index, k-ring 1 is defined as k-ring 0 and all neighboring indexes, and so on.
indices within k distance of the origin index.
gridDiskDistances(cell = c("8cbe63562a54bff","8cbe635631103ff") , k = c(1L, 2L))
gridDiskDistances(cell = c("8cbe63562a54bff","8cbe635631103ff") , k = c(1L, 2L))
Provides the distance in grid cells between the two indexes.
gridDistance(origin, destination)
gridDistance(origin, destination)
origin |
vector of origin H3 cell indexes |
destination |
vector of destination H3 cell indexes |
the grid distance between the two H3 cells
gridDistance(origin = c("85283473fffffff","85283473fffffff"), destination = c("8528342bfffffff","85283477fffffff"))
gridDistance(origin = c("85283473fffffff","85283473fffffff"), destination = c("8528342bfffffff","85283477fffffff"))
Given two H3 indexes, return the line of indexes between them (inclusive).
gridPathCells(origin, destination)
gridPathCells(origin, destination)
origin |
vector of origin H3 cell indexes |
destination |
vector of destination H3 cell indexes |
This function may fail to find the line between two indexes, for example if they are very far apart. It may also fail when finding distances for indexes on opposite sides of a pentagon.
the line of indexes between the two H3 cells
gridPathCells(origin = c("85283473fffffff","85283473fffffff") , destination = c("85283471fffffff","85283477fffffff"))
gridPathCells(origin = c("85283473fffffff","85283473fffffff") , destination = c("85283471fffffff","85283477fffffff"))
Produces the hollow hexagonal ring centered at origin with sides of length k.
gridRingUnsafe(cell, k)
gridRingUnsafe(cell, k)
cell |
vector of H3 cells |
k |
side length |
the indices of the hollow hexagonal ring centered at origin with sides of length k.
gridRingUnsafe(cell = c("8cbe63562a54bff","85283473fffffff"), k = c(2L, 1L))
gridRingUnsafe(cell = c("8cbe63562a54bff","85283473fffffff"), k = c(2L, 1L))
Returns non-zero if this index represents a pentagonal cell.
isPentagon(cell)
isPentagon(cell)
cell |
vector of H3 cells |
a vector the same length as cell
indicating if the cell is Class II
isPentagon(cell = c("8cbe63562a54bff","8cbe635631103ff"))
isPentagon(cell = c("8cbe63562a54bff","8cbe635631103ff"))
Returns non-zero if this index has a resolution with Class III orientation.
isResClassIII(cell)
isResClassIII(cell)
cell |
vector of H3 cells |
a vector the same length as cell
indicating if the cell is Class II
isResClassIII(cell = c("8cbe63562a54bff","8cbe635631103ff")) hex8 <- "88bf4ac0cdfffff" hex9 <- "89bf4ac0cd7ffff" hex10 <- "8abf4ac0cd67fff" isResClassIII(cell = c(hex8, hex9, hex10))
isResClassIII(cell = c("8cbe63562a54bff","8cbe635631103ff")) hex8 <- "88bf4ac0cdfffff" hex9 <- "89bf4ac0cd7ffff" hex10 <- "8abf4ac0cd67fff" isResClassIII(cell = c(hex8, hex9, hex10))
Returns non-zero if this is a valid H3 cell index
isValidCell(cell)
isValidCell(cell)
cell |
vector of H3 cells |
a vector the same length as cell
giving the validity of the cell
isValidCell(cell = c("8cbe63562a54bff","8cbe635631103ff", "abc", "3"))
isValidCell(cell = c("8cbe63562a54bff","8cbe635631103ff", "abc", "3"))
Determines if the provided H3Index is a valid unidirectional edge index.
isValidDirectedEdge(edge)
isValidDirectedEdge(edge)
edge |
vector of unidirectional edge H3 indexes |
1 if it is a unidirectional edge H3Index, otherwise 0.
isValidDirectedEdge(edge = c("13d2a1672b34ffff","16a2a1072b59ffff"))
isValidDirectedEdge(edge = c("13d2a1672b34ffff","16a2a1072b59ffff"))
Tests if the given vertex is a valid H3 vertex
isValidVertex(vertex)
isValidVertex(vertex)
vertex |
H3 Vertex index |
returns 1 if the given index is a valid H3 vertex
isValidVertex(vertex = c("24cbe63562a549ff", "abc"))
isValidVertex(vertex = c("24cbe63562a549ff", "abc"))
Indexes the location at the specified resolution, returning the index of the cell containing the location. This buckets the geographic point into the H3 grid
latLngToCell(lat, lng, resolution)
latLngToCell(lat, lng, resolution)
lat |
latitude |
lng |
longitude |
resolution |
cell resolution |
vector giving the H3 cell for each input lat/lng pair, at the given resolution
latLngToCell( lat = c(-37.820197, -37.818476) , lng = c(144.983324, 144.967354) , resolution = c(12, 12) )
latLngToCell( lat = c(-37.820197, -37.818476) , lng = c(144.983324, 144.967354) , resolution = c(12, 12) )
Produces an H3 index from local IJ coordinates anchored by an origin.
localIjToCell(origin, i, j)
localIjToCell(origin, i, j)
origin |
vector of anchor cell |
i |
vector of local I coordinate |
j |
vector of local I coordinate |
cell vector of H3 cells
localIjToCell( origin = c("85283473fffffff","85283473fffffff") , i = c(1L, 2L) , j = c(2L, 1L) )
localIjToCell( origin = c("85283473fffffff","85283473fffffff") , i = c(1L, 2L) , j = c(2L, 1L) )
Get all of the directed edges from an origin
originToDirectedEdges(origin)
originToDirectedEdges(origin)
origin |
vector of origin H3 cell indexes |
a vector for each origin with all of the directed edges from the current H3Index
originToDirectedEdges(origin = c("85283473fffffff","8cbe635631103ff"))
originToDirectedEdges(origin = c("85283473fffffff","8cbe635631103ff"))
Returns the h3 indexes for the input GeoJSON-like data structure
polygonToCells(polygons, resolution, isLatLng = TRUE)
polygonToCells(polygons, resolution, isLatLng = TRUE)
polygons |
A list of polygons. Each polygon is list of matrices. |
resolution |
The resolution of the output cells |
isLatLng |
|
h3 indexes for the input GeoJSON-like data structure
## single polygon polygon <- list( list( matrix( c( 37.813318999983238, -122.4089866999972145, 37.7198061999978478, -122.3544736999993603, 37.8151571999998453, -122.4798767000009008 ) , ncol = 2 , byrow = TRUE ) ) ) polygonToCells(polygon, resolution = 7L) ## poylgon with a hole polygon <- list( list( matrix( c( 37.813318999983238, -122.4089866999972145, 37.7198061999978478, -122.3544736999993603, 37.8151571999998453, -122.4798767000009008 ) , ncol = 2 , byrow = TRUE ), matrix( c( 37.813318999983238, -122.4089866999972145, 37.7198061999978478, -122.3544736999993603, 37.8151571999998453, -122.4498767000009008 ) , ncol = 2 , byrow = TRUE ) ) ) polygonToCells(polygon, resolution = 7L) ## Many polygons polygon <- list( list( matrix( c( 37.813318999983238, -122.4089866999972145, 37.7198061999978478, -122.3544736999993603, 37.8151571999998453, -122.4798767000009008 ) , ncol = 2 , byrow = TRUE ) ), list( matrix( c( 37.813318999983238, -122.4089866999972145, 37.7198061999978478, -122.3544736999993603, 37.8151571999998453, -122.4498767000009008 ) , ncol = 2 , byrow = TRUE ) ) ) polygonToCells(polygon, resolution = c(7L, 7L))
## single polygon polygon <- list( list( matrix( c( 37.813318999983238, -122.4089866999972145, 37.7198061999978478, -122.3544736999993603, 37.8151571999998453, -122.4798767000009008 ) , ncol = 2 , byrow = TRUE ) ) ) polygonToCells(polygon, resolution = 7L) ## poylgon with a hole polygon <- list( list( matrix( c( 37.813318999983238, -122.4089866999972145, 37.7198061999978478, -122.3544736999993603, 37.8151571999998453, -122.4798767000009008 ) , ncol = 2 , byrow = TRUE ), matrix( c( 37.813318999983238, -122.4089866999972145, 37.7198061999978478, -122.3544736999993603, 37.8151571999998453, -122.4498767000009008 ) , ncol = 2 , byrow = TRUE ) ) ) polygonToCells(polygon, resolution = 7L) ## Many polygons polygon <- list( list( matrix( c( 37.813318999983238, -122.4089866999972145, 37.7198061999978478, -122.3544736999993603, 37.8151571999998453, -122.4798767000009008 ) , ncol = 2 , byrow = TRUE ) ), list( matrix( c( 37.813318999983238, -122.4089866999972145, 37.7198061999978478, -122.3544736999993603, 37.8151571999998453, -122.4498767000009008 ) , ncol = 2 , byrow = TRUE ) ) ) polygonToCells(polygon, resolution = c(7L, 7L))
Converts Radians to Degrees
radsToDegs(rad)
radsToDegs(rad)
rad |
vector of radians |
numeric vector giving the input rad
values as degrees
radsToDegs(rad = seq(0, 2 * pi, by = (pi / 12) ) )
radsToDegs(rad = seq(0, 2 * pi, by = (pi / 12) ) )
A data set of train stations in Melbourne
stations
stations
The ID of the station
The name of the station
The latitude coordinate of the station
The longitude coordinate of the station
Obtained from https://discover.data.vic.gov.au/dataset/gtfs-schedule and distributed under the Creative Commons 4 License https://creativecommons.org/licenses/by/4.0/
This function uncompacts the provided set of compacted H3 cell indexes to the specified resolution.
uncompactCells(compactedSet, resolution)
uncompactCells(compactedSet, resolution)
compactedSet |
list of character vectors containing compacted H3 cell indexes |
resolution |
integer specifying the resolution for the uncompacted cells |
a list of character vectors containing the uncompacted H3 cell indexes at the specified resolution
uncompactCells( compactCells( gridDisk( cell = c("85283477fffffff", "85283423fffffff") , k = c(1L, 2L) ) ) , res = c(5L, 5L) )
uncompactCells( compactCells( gridDisk( cell = c("85283477fffffff", "85283423fffffff") , k = c(1L, 2L) ) ) , res = c(5L, 5L) )
Returns the latitude and longitude of the given vertex
vertexToLatLng(vertex)
vertexToLatLng(vertex)
vertex |
H3 Vertex index |
data.frame
of the lat/lng coordinates of the input vertex
vertices <- cellToVertex( cell = c(rep("8cbe63562a54bff", 6)) , vertexNum = c(0L:5L) ) vertexToLatLng(vertex = vertices)
vertices <- cellToVertex( cell = c(rep("8cbe63562a54bff", 6)) , vertexNum = c(0L:5L) ) vertexToLatLng(vertex = vertices)