data(build)
time = as.POSIXct("2004-12-24 13:30:00", tz = "Asia/Jerusalem")
solar_pos = maptools::solarpos(
matrix(c(34.7767978098526, 31.9665936050395), ncol = 2),
time
)
seg = shadow::toSeg(build[2, ])[5:10, ]
# Calculate shade proportion for walls 5-10 of 2nd building
props = shadePropWall(
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
plot(build)
plot(seg, add = TRUE, col = "red", lwd = 2)
raster::text(rgeos::gCentroid(seg, byid = TRUE), round(props, 2), cex = 0.75)
Run the code above in your browser using DataLab