Reputation: 372
I have a shapefile that I export from QGIS and load using the sf library in R. The shapefile contains an attribute "description" which is a link to a website. I use this shapefile to create an interactive leaflet map. I would like the "description" attribute to show up as a hyperlink that can be selected when using the leaflet map interactively.
Code:
library(shiny)
library(shinydashboard)
library(plotly)
library(sf)
library(maps)
library(tmap)
library(mapview)
library(leaflet)
library(tmaptools)
library(DT)
#Read in Data Files
AZ_Hunt_Units <- sf::st_read("AZHuntDash_v1.0/All_Arizona_SHPv2/All_Arizona_v2.shp", quiet = TRUE)
output$tmapA = renderLeaflet({
p =tm_shape(AZ_Hunt_Units)+
tm_fill("grey",0.1) + tm_borders("purple",lwd=2)+tm_basemap(server ="OpenStreetMap")+tm_text("Name",size=1,col="red",fontface="bold")
tmap_leaflet(p)
})
Upvotes: 0
Views: 131