horizon: Horizon Angle Computation

View source: R/horizon.R

horizonR Documentation

Horizon Angle Computation

Description

This function calculates the horizon angle of given points using an elevation raster map

Usage

horizon(
  r,
  points = data.frame(x = c(0, (xmin(r) + xmax(r))/2), y = c(0, (ymin(r) + ymax(r))/2)),
  adjust.zero = TRUE,
  n = 8,
  radius = 50000,
  names = NULL
)

Arguments

r

Raster* object contianing the Digital Elevation Map

points

data frame containing x and y coordinaates

adjust.zero

logical value. It it is TRUE, negative horizon angle are not considered.

n

number of directions used. Default is 8.

radius

see xyFrom2PointLine

names

names of the points

Value

It returns a list of data frames. A list element represents a examined point and contains n horizon angles for all n direction. The vertical horizon angle are conterclockwise referred to the horizontal axis and are expressed in degree units.

See Also

xyFrom2PointLine

Examples


library(horizons)
library(raster)

# First Example: Spare Hull
side <- 5010
n <- 501

values <- array(NA,c(n,n))
coord <- (1:n)/n*side-side/2
values <- outer(X=coord,Y=coord,FUN=function(x,y) {(x^2+y^2)^0.5})

r <- raster(values, crs=NA,xmn=-side/2,xmx=side/2,ymn=-side/2,ymx=side/2)


xpp <- c(-side/3,0,0,0,side/3)
ypp <- c(0,-side/3,0,side/3,0)
idp <- c("A","B","O","C","D")
points <- data.frame(x=xpp,y=ypp,id=idp)

hor <- horizon(r,points=points)
names(hor) 
points$id





# Second Example 

dem <- raster(system.file("dem/dem_rendena.asc",package="horizons"))

horizons <- horizon(dem)












ecor/horizons documentation built on Jan. 4, 2024, 6:25 p.m.