suppressMessages(require(shiny))
suppressMessages(require(miniUI))
suppressMessages(require(leaflet))
suppressMessages(require(measurements))
fileName <- "DutchLatLong.csv"
locations <- read.csv2(fileName)
# change the degree symbol to a space
locations$lat <- gsub('ø', ' ', locations$Latitude)
locations$lat <- gsub('\'N', ' 0', locations$lat)
locations$long <- gsub('ø', ' ', locations$Longitude)
locations$long <- gsub('\'E', ' 0', locations$long)
# convert from decimal minutes to decimal degrees
locations$lat <- measurements::conv_unit(locations$lat, from = 'deg_min_sec', to = 'dec_deg')
locations$long <- (measurements::conv_unit(locations$long, from = 'deg_min_sec', to = 'dec_deg'))
dutchIcon <- makeIcon(
iconUrl = "dutchIcon.png",
iconWidth = 15,
iconHeight = 15,
iconAnchorX = 14.5,
iconAnchorY = 16
)
If you click o the icons it will popup the name of the location / area
mymap <- leaflet() %>%
addTiles() %>%
addMarkers(lat=locations$lat, lng=locations$long,
popup=locations$Location,clusterOptions = markerClusterOptions(),
icon = dutchIcon)
mymap