deg2rect: Given position return rectangle code.

Description Usage Arguments Details Value Note Author(s) See Also Examples

Description

Functions that convert positions in decimal degrees latitude and longitude to rectangle codes for statistical rectangles, their subrectangles or rectangle codes in systems of various resolutions as described below and relating to (see rect2deg).

Usage

1
2
3
4
5
6
7
d2r(lat, lon = NULL)

d2sr(lat, lon = NULL)

d2mr(lat, lon = NULL, dlat = 5, dlon = 10)

d2dr(lat, lon = NULL, dlat = 1, dlon = 2, startLat = 50)

Arguments

lat,lon

Position(s) as decimal degrees latitude and longitude. If lat is list its components lat$lat and lat$lon are used for lat and lon.

dlat,dlon

Rectangle height and width in degrees and minutes latitude and longitude for d2dr and d2mr respectively.

startLat

Starting latitude used in coding the rectangles.

Details

A small number (1e-06) is added to latitude and subtracted from longitude to ensure rectangle membership of positions on border are “logical” on the nw-hempisphere.

Value

Vector of rectangle codes in the chosen coding system.

Note

These functions could be made hemisphere-aware, and no attention has been given to making the functions work in the southern hemisphere, possibly with the option of specifying starting latitudes.

Author(s)

HB (d2r, d2sr, STJ (d2mr, d2dr).

See Also

rect2deg

Examples

1
2
3
4
5
6
## tally positions in rectangles in object \code{\link{island}} giving
## Iceland's coastline

data(island)
rects <- d2r(island)
table(rects)

geo documentation built on May 29, 2017, 5:36 p.m.