data(build)
time = as.POSIXct("2004-12-24 12:30:00", tz = "Asia/Jerusalem")
solar_pos = maptools::solarpos(
matrix(c(34.7767978098526, 31.9665936050395), ncol = 2),
time
)
seg = shadow::toSeg(build[2, ])[5, ]
# Show wall position on a map
plot(build)
plot(seg, add = TRUE, col = "red", lwd = 3)
# Calculate wall 'image'
img = shadow::shadeImageWall(
seg = seg,
seg_height_field = "BLDG_HT",
build = build,
build_height_field = "BLDG_HT",
solar_pos = solar_pos,
sample_dist = 1,
shift_dist = 0.01
)
# Plot wall image
z = reshape2::acast(img, width ~ height_ctr, value.var = "shade")
image(
x = sort(unique(img$width)),
y = sort(unique(img$height_ctr)),
z = z,
asp = 1, axes = FALSE, frame.plot = FALSE,
xlab = "Ground distance (m)", ylab = "Height (m)",
col = c("yellow", "grey")
)
rect(
xleft = min(img$width) - max(diff(sort(img$width)))/2,
ybottom = min(img$height_ctr) - max(diff(sort(img$width)))/2,
xright = max(img$width) + max(diff(sort(img$width)))/2,
ytop = max(img$height_ctr) + max(diff(sort(img$width)))/2
)
axis(side = 1, labels = TRUE)
axis(side = 2, labels = TRUE)
Run the code above in your browser using DataLab