Learn R Programming

geo (version 1.4-3)

deg2rect: Given position return rectangle code.

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

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.

Value

Vector of rectangle codes in the chosen coding system.

Details

  • r2d with a resolution of 30 min latitue and 1 deg longitude (the Icelandic numbering system, 'tilkynningaskyldureitir').

  • sr2d with a resolution of 15 min latitude by 30 min longitude in the Icelandic numbering system for statistical rectangles which starts counting at 60 deg N latitude, with sub-rectangles of 30 min lat by 1 deg lon coded 1, 2, 3 and 4 for the NW, NA, SW and SA quadrants respectively

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.

See Also

rect2deg

Examples

Run this code
## tally positions in rectangles in object \code{\link{island}} giving
## Iceland's coastline

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

Run the code above in your browser using DataLab