Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

locate

Basic lookup function of coordinates on an icosahedral grid


Description

Basic lookup function of coordinates on an icosahedral grid

Usage

locate(x, y, ...)

## S4 method for signature 'trigrid,matrix'
locate(x, y, randomborder = FALSE, output = "ui")

## S4 method for signature 'trigrid,numeric'
locate(x, y, ...)

## S4 method for signature 'trigrid,data.frame'
locate(x, y, ...)

## S4 method for signature 'trigrid,SpatialPoints'
locate(x, y, ...)

## S4 method for signature 'trigrid,SpatialPointsDataFrame'
locate(x, y, ...)

## S4 method for signature 'hexagrid,matrix'
locate(x, y, output = "ui", randomborder = FALSE, forceNA = FALSE)

Arguments

x

(trigrid, hexagrid) Icosahedral grid object.

y

(matrix, data.frame, numeric or Spatial) Coordinates of individual points. Can be either a two-dimensional matrix of long-lat coordinates, a three-dimensional matrix of XYZ coordinates, or a set of points with class SpatialPoints or SpatialPointsDataFrame.

...

Arguments passed to class specific methods.

randomborder

(logical) Defaults to FALSE. If TRUE, then the points falling on vertices and edges will be randomly assigned, otherwise they will be kept as NAs.

output

(character) Either "ui" or "skeleton". "ui" returns the face names used in the user interface, while "skeleton" returns their indices used in back-end procedures.

forceNA

(logical) Suppressing the recursive lookup of points falling on subface boundaries.

Value

The function returns the cell names (as character) where the input coordinates fall.

Examples

# create a grid 
g <- trigrid(4)
# some random points
randomPoints<-rpsphere(4, output="polar")
# cells
locate(g, randomPoints)

icosa

Global Triangular and Penta-Hexagonal Grids Based on Tessellated Icosahedra

v0.10.1
GPL-3
Authors
Adam T. Kocsis [aut, cre]
Initial release
2021-01-12

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.