Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Maps of recommended Auckland Unitary Plan overlays
# Maps of overlays in the IHP recommended Auckland Unitary Plan
# Setup
rm(list = ls())
library(maptools)
crs_nztm = CRS("+proj=tmerc +lat_0=0 +lon_0=173 +k=0.9996 +x_0=1600000 +y_0=10000000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs")
# Map config
line_width = 1
line_colour = rgb(100/255, 100/255, 100/255)
non_akl_fill = rgb(235/255, 235/255, 235/255)
overlay_fill = rgb(255/255, 0, 0, alpha = 0.3)
akl_bbox = matrix(c(1705000, 1828000, 5873000, 6010000),
nrow = 2,
ncol = 2,
dimnames = list(c("x", "y"), c("min", "max")),
byrow = TRUE)
central_bbox = matrix(c(1744413, 1775331, 5900750, 5933401),
nrow = 2,
ncol = 2,
dimnames = list(c("x", "y"), c("min", "max")),
byrow = TRUE)
map_width = 1600
# Coastline data
regions = readShapePoly("regions/REGC2015_GV_Clipped.shp", proj4string = crs_nztm)
# Set up a plot and plot coastline
plotSetup = function(file_name, bbox) {
map_aspect = (bbox["y", "max"] - bbox["y", "min"]) /
(bbox["x", "max"] - bbox["x", "min"])
map_height = round(map_width * map_aspect)
png(file_name, width = map_width, height = map_height)
par(mar = c(0, 0, 0, 0))
plot(0, 0,
type = "n",
axes = FALSE,
xlab = NA,
ylab = NA,
xlim = bbox["x", ],
ylim = bbox["y", ])
plot(regions,
col = ifelse(regions@data[, "REGC2015"] == "02", "white", non_akl_fill),
add = TRUE,
lwd = line_width,
border = line_colour)
}
# Plot an overlay layer
plotOverlay = function(o) {
plot(o,
col = overlay_fill,
add = TRUE,
border = FALSE)
}
# Viewshaft overlays
plotSetup("outputs/views.png", bbox = central_bbox)
local_volcanic_overlay = readShapePoly("RUP_SHP_20160803/MASTER_RUP_LocallySignificantVolcanicViewshafts.shp", proj4string = crs_nztm)
regional_volcanic_overlay = readShapePoly("RUP_SHP_20160803/MASTER_RUP_RegionallySignificantVolcanicViewShaftsAndHeightSensitiveAreasOverlay.shp", proj4string = crs_nztm)
local_views_overlay = readShapePoly("RUP_SHP_20160803/MASTER_RUP_LocalPublicViewsOverlay.shp", proj4string = crs_nztm)
plotOverlay(local_volcanic_overlay)
plotOverlay(regional_volcanic_overlay)
plotOverlay(local_views_overlay)
dev.off()
# Character & heritage overlays
plotSetup("outputs/character_heritage.png", bbox = central_bbox)
character_overlay = readShapePoly("RUP_SHP_20160803/MASTER_RUP_SpecialCharacterOverlay.shp", proj4string = crs_nztm)
heritage_overlay = readShapePoly("RUP_SHP_20160803/MASTER_RUP_HistoricHeritageExtentOfPlaceOverlay.shp", proj4string = crs_nztm)
plotOverlay(character_overlay)
plotOverlay(heritage_overlay)
dev.off()
# Natural environment & heritage
plotSetup("outputs/natural_environment.png", bbox = akl_bbox)
ecological_overlay = readShapePoly("RUP_SHP_20160803/MASTER_RUP_SignificantEcologicalAreasOverlay.shp", proj4string = crs_nztm)
ridgeline_overlay = readShapePoly("RUP_SHP_20160803/MASTER_RUP_RidgelineProtectionOverlay.shp", proj4string = crs_nztm)
outstanding_natural_landscape_overlay = readShapePoly("RUP_SHP_20160803/MASTER_RUP_OutstandingNaturalLandscapeOverlay.shp", proj4string = crs_nztm)
outstanding_natural_features_overlay = readShapePoly("RUP_SHP_20160803/MASTER_RUP_OutstandingNaturalFeaturesOverlay.shp", proj4string = crs_nztm)
outstanding_natural_character_overlay = readShapePoly("RUP_SHP_20160803/MASTER_RUP_OutstandingNaturalCharacterOverlay.shp", proj4string = crs_nztm)
high_natural_character_overlay = readShapePoly("RUP_SHP_20160803/MASTER_RUP_HighNaturalCharacterOverlay.shp", proj4string = crs_nztm)
waitakere_heritage_overlay = readShapePoly("RUP_SHP_20160803/MASTER_RUP_WaitakereRangesHeritageAreaOverlay.shp", proj4string = crs_nztm)
plotOverlay(ecological_overlay)
plotOverlay(ridgeline_overlay)
plotOverlay(outstanding_natural_landscape_overlay)
plotOverlay(outstanding_natural_features_overlay)
plotOverlay(outstanding_natural_character_overlay)
plotOverlay(high_natural_character_overlay)
plotOverlay(waitakere_heritage_overlay)
dev.off()
# Other
plotSetup("outputs/other.png", bbox = akl_bbox)
aircraft_noise_overlay = readShapePoly("RUP_SHP_20160803/MASTER_RUP_AircraftNoiseOverlay.shp", proj4string = crs_nztm)
airport_approach_overlay = readShapePoly("RUP_SHP_20160803/MASTER_RUP_AirportApproachSurfaceOverlay.shp", proj4string = crs_nztm)
mana_whenua_overlay = readShapePoly("RUP_SHP_20160803/MASTER_RUP_SitesAndPlacesOfSignificanceToManaWhenuaOverlay.shp", proj4string = crs_nztm)
port_noise_overlay = readShapePoly("RUP_SHP_20160803/MASTER_RUP_CityCentrePortNoiseOverlay.shp", proj4string = crs_nztm)
quarry_buffer_overlay = readShapePoly("RUP_SHP_20160803/MASTER_RUP_QuarryBufferAreaOverlay.shp", proj4string = crs_nztm)
national_grid_overlay = readShapePoly("RUP_SHP_20160803/MASTER_RUP_NationalGridCorridorOverlay.shp", proj4string = crs_nztm)
plotOverlay(aircraft_noise_overlay)
plotOverlay(airport_approach_overlay)
plotOverlay(mana_whenua_overlay)
plotOverlay(port_noise_overlay)
plotOverlay(quarry_buffer_overlay)
plotOverlay(national_grid_overlay)
dev.off()
# Everything -- Auckland region
plotSetup("outputs/all-region.png", bbox = akl_bbox)
plotOverlay(local_volcanic_overlay)
plotOverlay(regional_volcanic_overlay)
plotOverlay(local_views_overlay)
plotOverlay(character_overlay)
plotOverlay(heritage_overlay)
plotOverlay(ecological_overlay)
plotOverlay(ridgeline_overlay)
plotOverlay(outstanding_natural_landscape_overlay)
plotOverlay(outstanding_natural_features_overlay)
plotOverlay(outstanding_natural_character_overlay)
plotOverlay(high_natural_character_overlay)
plotOverlay(ecological_overlay)
plotOverlay(ridgeline_overlay)
plotOverlay(outstanding_natural_landscape_overlay)
plotOverlay(outstanding_natural_features_overlay)
plotOverlay(outstanding_natural_character_overlay)
plotOverlay(high_natural_character_overlay)
plotOverlay(waitakere_heritage_overlay)
plotOverlay(aircraft_noise_overlay)
plotOverlay(airport_approach_overlay)
plotOverlay(mana_whenua_overlay)
plotOverlay(port_noise_overlay)
plotOverlay(quarry_buffer_overlay)
plotOverlay(national_grid_overlay)
dev.off()
# Everything -- Central area
plotSetup("outputs/all-central.png", bbox = central_bbox)
plotOverlay(local_volcanic_overlay)
plotOverlay(regional_volcanic_overlay)
plotOverlay(local_views_overlay)
plotOverlay(character_overlay)
plotOverlay(heritage_overlay)
plotOverlay(ecological_overlay)
plotOverlay(ridgeline_overlay)
plotOverlay(outstanding_natural_landscape_overlay)
plotOverlay(outstanding_natural_features_overlay)
plotOverlay(outstanding_natural_character_overlay)
plotOverlay(high_natural_character_overlay)
plotOverlay(ecological_overlay)
plotOverlay(ridgeline_overlay)
plotOverlay(outstanding_natural_landscape_overlay)
plotOverlay(outstanding_natural_features_overlay)
plotOverlay(outstanding_natural_character_overlay)
plotOverlay(high_natural_character_overlay)
plotOverlay(waitakere_heritage_overlay)
plotOverlay(aircraft_noise_overlay)
plotOverlay(airport_approach_overlay)
plotOverlay(mana_whenua_overlay)
plotOverlay(port_noise_overlay)
plotOverlay(quarry_buffer_overlay)
plotOverlay(national_grid_overlay)
dev.off()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment