This page contains a national summary of the texture from the LTPP database.
The code to generate this is displayed first - then the graphics.
Use the menu to left to go straight to the texture for all sites, State Highway sites, Local Authority sites or Individual sites.
The code below imports the data from the 10m databases
#Sys.Date()
Sys.time()
## [1] "2021-11-29 11:09:26 NZDT"
#load database connection library
library(RODBC)
db <- "C:/local_databases/NZTA_SH&LA_LTPPData_IntCalib_1Jul2001-30Jun2021.mdb"
con2 <- odbcDriverConnect(paste0("Driver={Microsoft Access Driver (*.mdb, *.accdb)}; DBQ=", db))
Texture10m <- sqlFetch(con2, "10mTexture")
CalibrationSections <- sqlFetch(con2, "CalibrationSections")
library(tidyverse)
Councils <- CalibrationSections %>% filter(is.na(Region)) %>% group_by(NMA) %>% summarise()
# Create SH/LA column
library(dplyr)
library(stringr)
CalibrationSections <- CalibrationSections %>% mutate(OwnerType = if_else((str_detect(CAL_SECTION_ID, "CAL")|str_detect(CAL_SECTION_ID, "CS")), "SH", "LA"))
Texture10m <- Texture10m %>% left_join(CalibrationSections, by = c("SECTION_ID"="CAL_SECTION_ID"))
#Texture Plots
library(dplyr)
Texture10mL <- Texture10m %>% filter(LWPTxt < 10)
Texture10mR <- Texture10m %>% filter(RWPTxt < 10)
library(ggplot2)
ggobj2 <- ggplot(data=Texture10mL, aes(x=FinancialYear, y=LWPTxt, col = as.factor(LANE_DIRECTION))) +
geom_boxplot() + ggtitle("All Texture10m LWP Boxplot") + facet_wrap(~SECTION_ID, ncol=5) + theme(axis.text.x=element_text(angle=90,hjust=1,vjust=0.5)) + labs(col = "I/D") + ylab("LWP Texture MPD (mm)") + xlab("Financial Year")
print(ggobj2)
ggobj2 <- ggplot(data=Texture10mR, aes(x=FinancialYear, y=RWPTxt, col = as.factor(LANE_DIRECTION))) +
geom_boxplot() + ggtitle("All Texture10m RWP Boxplot") + facet_wrap(~SECTION_ID, ncol=5) + theme(axis.text.x=element_text(angle=90,hjust=1,vjust=0.5)) + labs(col = "I/D") + ylab("RWP Texture MPD (mm)") + xlab("Financial Year")
print(ggobj2)
#SH Sites
Texture10mLSH <- Texture10mL %>% filter(OwnerType == "SH")
Texture10mRSH <- Texture10mR %>% filter(OwnerType == "SH")
library(ggplot2)
ggobj2 <- ggplot(data=Texture10mLSH, aes(x=FinancialYear, y=LWPTxt, col = as.factor(LANE_DIRECTION))) +
geom_boxplot() + ggtitle("SH Texture10m LWP Boxplot") + facet_wrap(~SECTION_ID, ncol=5) + theme(axis.text.x=element_text(angle=90,hjust=1,vjust=0.5)) + labs(col = "I/D") + ylab("LWP Texture MPD (mm)") + xlab("Financial Year")
print(ggobj2)
ggobj2 <- ggplot(data=Texture10mRSH, aes(x=FinancialYear, y=RWPTxt, col = as.factor(LANE_DIRECTION))) +
geom_boxplot() + ggtitle("SH Texture10m RWP Boxplot") + facet_wrap(~SECTION_ID, ncol=5) + theme(axis.text.x=element_text(angle=90,hjust=1,vjust=0.5)) + labs(col = "I/D") + ylab("RWP Texture MPD (mm)") + xlab("Financial Year")
print(ggobj2)
#LA Sites
Texture10mLLA <- Texture10mL %>% filter(OwnerType == "LA")
Texture10mRLA <- Texture10mR %>% filter(OwnerType == "LA")
library(dplyr)
ggobj2Texture10mL <- Texture10mL %>% group_by(SECTION_ID) %>% do(plots=ggplot(data=.) +
aes(x=FinancialYear, y=LWPTxt, col = as.factor(LANE_DIRECTION)) + geom_boxplot() + labs(col = "I/D") + ggtitle("LWP Texture", subtitle = .$SECTION_ID) + ylab("LWP Texture MPD (mm)") + xlab("Financial Year"))
print(ggobj2Texture10mL$plots)
## [[1]]
##
## [[2]]
##
## [[3]]
##
## [[4]]
##
## [[5]]
##
## [[6]]
##
## [[7]]
##
## [[8]]
##
## [[9]]
##
## [[10]]
##
## [[11]]
##
## [[12]]
##
## [[13]]
##
## [[14]]
##
## [[15]]
##
## [[16]]
##
## [[17]]
##
## [[18]]
##
## [[19]]
##
## [[20]]
##
## [[21]]
##
## [[22]]
##
## [[23]]
##
## [[24]]
##
## [[25]]
##
## [[26]]
##
## [[27]]
##
## [[28]]
##
## [[29]]
##
## [[30]]
##
## [[31]]
##
## [[32]]
##
## [[33]]
##
## [[34]]
library(dplyr)
ggobj2Texture10mR <- Texture10mR %>% group_by(SECTION_ID) %>% do(plots=ggplot(data=.) +
aes(x=FinancialYear, y=RWPTxt, col = as.factor(LANE_DIRECTION)) + geom_boxplot() + labs(col = "I/D") + ggtitle("RWP Texture", subtitle = .$SECTION_ID) + ylab("RWP Texture MPD (mm)") + xlab("Financial Year"))
print(ggobj2Texture10mR$plots)
## [[1]]
##
## [[2]]
##
## [[3]]
##
## [[4]]
##
## [[5]]
##
## [[6]]
##
## [[7]]
##
## [[8]]
##
## [[9]]
##
## [[10]]
##
## [[11]]
##
## [[12]]
##
## [[13]]
##
## [[14]]
##
## [[15]]
##
## [[16]]
##
## [[17]]
##
## [[18]]
##
## [[19]]
##
## [[20]]
##
## [[21]]
##
## [[22]]
##
## [[23]]
##
## [[24]]
##
## [[25]]
##
## [[26]]
##
## [[27]]
##
## [[28]]
##
## [[29]]
##
## [[30]]
##
## [[31]]
##
## [[32]]
##
## [[33]]
##
## [[34]]
close(con2)