hypertidy/anglr

rainy day funtimes

Closed this issue · 3 comments

Mesh each extent with its elevation average and plot in 3d

library(vapour)
## raadfiles and bowerbird
f <- raadfiles::thelist_files()


## biggest tab file is 111
## listdata.thelist.tas.gov.au/opendata/data/list_aerial_photo_coverages_statewide.tab
ss <- as_tibble(vapour_geom_summary(f$fullname[111]))
aa <- as_tibble(vapour_read_attributes(f$fullname[111]))
ss$fiveyear <- (as.integer(aa$FLY_YEAR) %/% 5) * 5
ss$decade <- (as.integer(aa$FLY_YEAR) %/% 10) * 10
ggplot(ss, aes(xmin = xmin, ymin = ymin, xmax = xmax, ymax = ymax)) + geom_rect(fill = NA, colour = rgb(0, 0, 0, 0.05)) + facet_wrap(~fiveyear) + coord_equal()

Also, gganimate the sequence

Update code above

library(vapour)
## raadfiles and bowerbird
f <- raadfiles::thelist_files()


(ii <- grep("list_aerial_photo_coverages_statewide", f$fullname))
## is now gdb
## listdata.thelist.tas.gov.au/opendata/data/list_aerial_photo_coverages_statewide.tab
ss <- tibble::as_tibble(vapour_geom_summary(f$fullname[ii]))
aa <- tibble::as_tibble(vapour_read_attributes(f$fullname[ii], 
    sql = "SELECT FLY_YEAR, ALTITUDE FROM list_aerial_photo_coverages_statewide"))
ss$fiveyear <- (as.integer(aa$FLY_YEAR) %/% 5) * 5
ss$decade <- (as.integer(aa$FLY_YEAR) %/% 10) * 10
library(ggplot2)
ggplot(ss, aes(xmin = xmin, ymin = ymin, xmax = xmax, ymax = ymax, fill = ALTITUDE)) + 
  geom_rect(fill = NA, colour = rgb(0, 0, 0, 0.05)) +

  facet_wrap(~fiveyear) + coord_equal()

image

it's kind of cute

image

library(rgl)

reps <- rep(seq(1, nrow(d)*4, by = 4), each = 4)-1
xl <- c(1, 2, 2, 1) + reps
yl <- c(1, 1, 2, 2) + reps
avb <- rbind(x = as.vector(t(cbind(d$xmin, d$xmax)))[xl], 
             y = as.vector(t(cbind(d$ymin, d$ymax)))[yl], 
             z = rep(as.numeric(d$FLY_YEAR), each = 4), 
             h = 1)
idx <- matrix(seq(1, nrow(d) * 4), 4)
mesh <- qmesh3d(avb, idx)
mesh$material$color <- colourvalues::colour_values(d$ALTITUDE)
plot3d(mesh, alpha = 0.1)
aspect3d(1, 1, 10)