Learn R Programming

ElevDistr (version 1.0.9)

generate_grid: Generate a grid around the input point

Description

Generate a grid around a longitude and latitude, with a defined square size and step size.

Usage

generate_grid(lon, lat, squareSize = 10, stepSize = 0.0025)

Value

A list containing a data frame with longitude and latitude of the grid and a vector containing the length of the longitudinal and latitudinal sequence.

Arguments

lon

Longitude of the grid center (in degrees; WGS 84). One value, data type "numeric" and finite.

lat

Latitude of the grid center (in degrees; WGS 84). One value, data type "numeric" and finite.

squareSize

Square size (in km). One value, data type "numeric" and finite.

stepSize

Step size for the square sampling (in degree). One value, data type "numeric" and finite.

Author

Livio Bätscher, Jurriaan M. de Vos

Examples

Run this code
#Generate a 10x10 km grid with a step size of 0.0025 degrees
temp <- generate_grid(lon = 8.728898, lat = 46.93756, squareSize = 10, stepSize = 0.0025)

#Part of the generated coordinates
temp$df[105:115,]

Run the code above in your browser using DataLab