# NOT RUN {
#Using provided dataset for the Boston Strangler Incidents:
data(desalvo)
test <- cgt_profile(desalvo$lat, desalvo$lon)
g_map = sp::SpatialPixelsDataFrame(points = test[c("lons", "lats")], data = test)
g_map <- raster::raster(g_map)
# Assign a Coordinate Reference System for the Raster
raster::crs(g_map) <- sp::CRS("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs")
# Define a Parula Color Pallete for Resultant Jeopardy Surface
library(leaflet) #for mapping the geographic profile
pal <- colorNumeric(pals::parula(200), raster::values(g_map),
na.color = "transparent")
leaflet() %>%
addTiles() %>%
addProviderTiles('Esri.WorldTopoMap', group = 'Topo') %>%
addAwesomeMarkers(lng = -71.07357, lat = 42.41322, icon =
awesomeIcons(icon = 'home', markerColor = 'green'), popup = 'Residence') %>%
addRasterImage(g_map, colors = pal, opacity = 0.6) %>%
addLegend(pal = pal, values = raster::values(g_map), title = 'Score') %>%
addCircleMarkers(lng = desalvo$lon, lat = desalvo$lat, radius = 4, opacity = 1,
fill = 'black', stroke = TRUE, fillOpacity = 0.75, weight = 2,
fillColor = "red")
# }
Run the code above in your browser using DataLab