datatable(ZS_analysis,
rownames = FALSE,
width = '100%',
# class = 'stripe',
# container = sketch,
# caption = htmltools::tags$caption(
# style = 'caption-side: bottom; text-align: center;',
# 'Table 2: ', htmltools::em('This is a simple caption for the table.')),
options = list(
# scrollY = '500px',
# scrollX = TRUE,
# pageLength = 20,
# lengthMenu = c(10, 20, 50),
# dom = 'fltip', # show table, info & paging, fliter
# autoWidth = TRUE,
columnDefs = list(list(width = '20px', targets = "_all"))
)
) %>% formatRound(2:6, 2) %>% formatRound(9:10, 2)
# define some global variables for folders
base_folder <- getwd()
# will need to fix this hard coding.......
maps_folder = "/Users/geremida/Dropbox/ZENE/R/EQld_NetworkMaps/Energex_maps/"
myZoneSub <- st_read(dsn = paste0(maps_folder,"EnegexZoneSub.shp"))
## Reading layer `EnegexZoneSub' from data source
## `/Users/geremida/Dropbox/ZENE/R/EQld_NetworkMaps/Energex_maps/EnegexZoneSub.shp'
## using driver `ESRI Shapefile'
## Simple feature collection with 324 features and 8 fields
## Geometry type: POINT
## Dimension: XY
## Bounding box: xmin: 151.9472 ymin: -28.1766 xmax: 153.5302 ymax: -25.94345
## Geodetic CRS: WGS 84
myLGA <- readRDS(file=paste0(maps_folder,"Queensland_LGA_map.rds"))
# tmap_mode(mode = "view")
#
# tm_shape(myLGA) + tm_polygons(col = "MAP_COLORS", alpha = 0.2,
# border.col = "darkmagenta",
# id='LGA') +
# tm_shape(myZoneSub)+tm_dots(size=0.1,id='SITE_ALIAS')
#
# tm_view(set.view = c(153, -27, 10)) # longitude 7, latitude 51, zoom 4 - approx Cabooluture
# Set value for the minZoom and maxZoom settings.
#leaflet(options = leafletOptions(minZoom = 0, maxZoom = 18))
# m <- leaflet() %>%
# addTiles() %>% # Add default OpenStreetMap map tiles
# addMarkers(lng=174.768, lat=-36.852, popup="The birthplace of R")
#
# setView(m,153,-27,7) # centre map near Caboolture
leaflet(data = myZoneSub) %>% addTiles() %>%
addMarkers(~LON, ~LAT, popup = ~as.character(SITE_ALIAS), label = ~as.character(SITE_ALIAS),
clusterOptions = markerClusterOptions()
)
# icons <- awesomeIcons(
# icon = 'ios-close',
# iconColor = 'black',
# library = 'ion',
# markerColor = 'red'
# )
#
# # https://icons.getbootstrap.com/assets/icons/asterisk.svg
#
# asterixIcon <- makeIcon(
# iconUrl = "https://leafletjs.com/examples/custom-icons/leaf-green.png"
# # ,
# # iconWidth = 30, iconHeight = 30
# )
#
# leaflet() %>% addTiles() %>%
# addPolygons(data = myLGA,
# color = "#444444", weight = 1, smoothFactor = 0.5,
# opacity = 1.0,
# fillOpacity = 0.5,
# label = ~as.character(LGA)
# ) %>%
# addAwesomeMarkers(data = myZoneSub,
# ~LON, ~LAT, popup = ~as.character(SITE_ALIAS), label = ~as.character(SITE_ALIAS),
# clusterOptions = markerClusterOptions(),
# icon = asterixIcon
# )
#
#
# leaflet() %>% addTiles() %>%
# addPolygons(data = myLGA,
# color = "#444444", weight = 1, smoothFactor = 0.5,
# opacity = 1.0,
# fillOpacity = 0.5,
# label = ~as.character(LGA)
# )
# addMarkers(~LON, ~LAT, popup = ~as.character(SITE_ALIAS), label = ~as.character(SITE_ALIAS),
# clusterOptions = markerClusterOptions() )
# myZoneSubLGA <- myZoneSub %>% mutate(
# intersection = as.integer(st_intersects(myZoneSub,myLGA)),
# LGA_loc = if_else(is.na(intersection), '', myLGA$LGA[intersection])
# )
# # for code example used see
# # https://gis.stackexchange.com/questions/282750/identify-polygon-containing-point-with-r-sf-package/343477#343477
#
# datatable(myZoneSubLGA[,c(3,11)],
# rownames = FALSE,
# width = '100%')
Here’s some sample code to try https://github.com/Adamishere/Fuzzymatching/blob/master/Fuzzy%20String%20Match%20FunctionV1.R
Once this is done, could have a pop-up from the map to display Zone Sub summary data Or link to some place to show Zone Sub data This last bit may have to be a Shiny App :-) Or could possibly do it on a subset, say in a smal LGA like Noosa
Comment out mapping code for now…..
Processing the csv data files……..