Last run : 3 Dec 2022, based on map data extracted 29 Nov 2022

Removed interactive for Noosa LGA polygon, LV hover uses Feeder name, and colorise by Feeder name so can differentiate

Read shp files

ok now display them

but best to use just 11kV feeders within “mygeometry”

display substations

my_filtered_list <- st_intersects(mySubstations, JustNoosaLGA,sparse = FALSE)
Noosa_Substations <- mySubstations[my_filtered_list, ]
Noosa_Substations$MAX_KVA <- as.numeric(as.character(Noosa_Substations$MAX_KVA))

Noosa_Substations_no_geom <- Noosa_Substations %>% st_drop_geometry() %>% select(c(1,3,4,5,6)) 
 
datatable(Noosa_Substations_no_geom)

display the map

tmap_mode(mode = "view")
## tmap mode set to interactive viewing
tm <- tm_shape(JustNoosaLGA) + tm_polygons(col = "MAP_COLORS", alpha = 0.2, border.col = "darkmagenta") +
tm_shape(myOH_132kV)+tm_lines(col='red', lwd=12) +
# tm_shape(myUG_132kV)+tm_lines(col='orange',lwd=10)+   nothing to display !
tm_shape(myOH_110kV)+tm_lines(col='blue',lwd=10)+
tm_shape(myUG_110kV)+tm_lines(col='green',lwd=10) +

tm_shape(myOH_33kV)+tm_lines(col='purple',lwd=8) +
tm_shape(myUG_33kV)+tm_lines(col='pink',lwd=8) +

tm_shape(Noosa_myOH_11kV)+tm_lines(col='black',lwd=4) +
tm_shape(Noosa_myUG_11kV)+tm_lines(col='brown',lwd=4) +
  
tm_shape(myZoneSub)+tm_dots(size=0.1) +
  
tm_shape(Noosa_myOH_LV)+tm_lines(col='red',lwd=2) +
tm_shape(Noosa_myUG_LV)+tm_lines(col='orange',lwd=2) +
tm_shape(Noosa_Substations)+tm_dots(size=0.04)
# tm_shape(myPillars) +tm_dots(size=0,06, col = 'pink')
tm
# see https://cran.r-project.org/web/packages/tmap/vignettes/tmap-getstarted.html
# Exporting maps section
# save as stand-alone HTML file ("view" mode)
tmap_save(tm, filename = "Simple_Energex_Map_Noosa_LGA.html")
## Interactive map saved to /Users/geremida/Dropbox/ZENE/R/EQld_NetworkMaps/Simple_Energex_Map_Noosa_LGA.html

How about just show substations >= 300KVA

Display & export to csv

# icon_path = "https://raw.githubusercontent.com/Rush/Font-Awesome-SVG-PNG/master/black/png/48/angle-double-down.png"
# icon_path = "https://raw.githubusercontent.com/Rush/Font-Awesome-SVG-PNG/master/black/png/48/arrow-circle-down.png"
# 
# 
# 
# tmapIcon <- tmap_icons(icon_path)
#tmapIcon <- tmap_icons("https://raw.githubusercontent.com/Rush/Font-Awesome-SVG-PNG/master/black/png/48/plane.png")



Noosa_Substations_300KVA <- Noosa_Substations %>% filter(MAX_KVA >= 300)

tm <- tm_shape(JustNoosaLGA) + tm_polygons(col = "MAP_COLORS", alpha = 0.2, border.col = "darkmagenta", interactive = FALSE) +
#tm_shape(JustNoosaLGA) + tm_polygons(col = "MAP_COLORS", alpha = 0.2, border.col = "darkmagenta") +
tm_shape(myOH_132kV)+tm_lines(col='red', lwd=12) +
# tm_shape(myUG_132kV)+tm_lines(col='orange',lwd=10)+   nothing to display !
tm_shape(myOH_110kV)+tm_lines(col='blue',lwd=10)+
tm_shape(myUG_110kV)+tm_lines(col='green',lwd=10) +

tm_shape(myOH_33kV)+tm_lines(col='purple',lwd=8) +
tm_shape(myUG_33kV)+tm_lines(col='pink',lwd=8) +

tm_shape(Noosa_myOH_11kV)+tm_lines(col='black',lwd=6,id='FEEDER') +
tm_shape(Noosa_myUG_11kV)+tm_lines(col='brown',lwd=6,id='FEEDER') +
  
tm_shape(myZoneSub)+tm_dots(col='grey' ,size=0.15,id='SITE_REF') +
  
tm_shape(Noosa_myOH_LV)+tm_lines(col = "FEEDER",lwd=2,id='FEEDER', legend.col.show = FALSE) +
tm_shape(Noosa_myUG_LV)+tm_lines(col="FEEDER",lwd=2,id='FEEDER', 
legend.col.show = FALSE) +
tm_shape(Noosa_Substations)+tm_dots( col='greenyellow', size=0.06, id='USER_REF_I') +
tm_shape(Noosa_Substations_300KVA)+tm_dots( col='green3', size=0.12, id='USER_REF_I')

# https://www.datanovia.com/en/blog/awesome-list-of-657-r-color-names/

tm
## Warning: Number of levels of the variable "FEEDER" is 698, which is
## larger than max.categories (which is 30), so levels are combined. Set
## tmap_options(max.categories = 698) in the layer function to show all levels.
## Warning: Number of levels of the variable "FEEDER" is 567, which is
## larger than max.categories (which is 30), so levels are combined. Set
## tmap_options(max.categories = 567) in the layer function to show all levels.
# see https://cran.r-project.org/web/packages/tmap/vignettes/tmap-getstarted.html
# Exporting maps section
# save as stand-alone HTML file ("view" mode)
tmap_save(tm, filename = "Simple_Energex_Map_Noosa_LGA_300KVA_plus.html")
## Warning: Number of levels of the variable "FEEDER" is 698, which is
## larger than max.categories (which is 30), so levels are combined. Set
## tmap_options(max.categories = 698) in the layer function to show all levels.

## Warning: Number of levels of the variable "FEEDER" is 567, which is
## larger than max.categories (which is 30), so levels are combined. Set
## tmap_options(max.categories = 567) in the layer function to show all levels.
## Interactive map saved to /Users/geremida/Dropbox/ZENE/R/EQld_NetworkMaps/Simple_Energex_Map_Noosa_LGA_300KVA_plus.html
Noosa_Substations_300KVA_no_geom <- Noosa_Substations_300KVA %>% st_drop_geometry() %>% select(c(1,3,4,5,6)) 
datatable(Noosa_Substations_300KVA_no_geom)
write.csv(Noosa_Substations_300KVA_no_geom,"Noosa_Substations_300KVA_no_geom.csv", row.names = FALSE)



# Noosa_Substations$type_sym <- factor(Noosa_Substations$TR_TYPE)
# tm_shape(Noosa_Substations) +
# #+tm_dots(size=0.075, popup.vars='SITE_DESC', id='MAX_KVA',col='dimgrey',shape = 20)
# tm_symbols(popup.vars=c('SITE_DESC','TR_TYPE','MAX_KVA'),
#            id='MAX_KVA',
# #           size = 0.001,
#           col = "MAX_KVA",
#           n=6,
#           alpha = 0.75,
#           shape = tmapIcon,
#           size = 0.10,
#           border.lwd = NA
#           )

#  tm_symbols(shape = tmapIcon, size = 0.15, border.lwd = NA)

Try some leaflet

# poleIcon <- makeIcon(
# #  iconUrl = "https://leafletjs.com/examples/custom-icons/leaf-green.png",
#   iconUrl = "https://cdn-icons.flaticon.com/png/512/6153/premium/6153262.png?token=exp=1639459124~hmac=d99fa2ad031b8da8898ed9af83ba2e52"
#   ,
#   iconWidth = 20, iconHeight = 22
#   )
# 
# leaflet(data = mySubstations) %>% addTiles() %>%
#   addMarkers(~LON, ~LAT, 
#              popup = ~as.character(TR_TYPE), 
#              label = ~as.character(MAX_KVA)
#              , 
#              icon = poleIcon
#              )
# 
# 
# # https://www.dropbox.com/s/is6q1zifjoytn5l/pole%2090%20x%2098.png
# 
# data()