The leaflet . e x tras Package IN TE R AC TIVE MAP S W ITH L E AFL E T IN R Rich Majer u s Assistant Vice President , Colb y College
The leaflet . e x tras Package We w ill foc u s on three e x tras : addSearchOSM() - make map searchable addReverseSearchOSM() - geocode w ith a mo u se click addResetMapButton() - reset map v ie w INTERACTIVE MAPS WITH LEAFLET IN R
addSearchOSM () leaflet() %>% addTiles() %>% addSearchOSM() INTERACTIVE MAPS WITH LEAFLET IN R
Find the T w ine Image B y TigerPa w2154, Wikipedia - P u blic Domain INTERACTIVE MAPS WITH LEAFLET IN R
addRe v erseSearchOSM () leaflet() %>% addTiles() %>% addSearchOSM() %>% addReverseSearchOSM() INTERACTIVE MAPS WITH LEAFLET IN R
addResetMapB u tton () leaflet() %>% addTiles() %>% addSearchOSM() %>% addReverseSearchOSM() %>% addResetMapButton() INTERACTIVE MAPS WITH LEAFLET IN R
Let ' s practice ! IN TE R AC TIVE MAP S W ITH L E AFL E T IN R
O v erla y Gro u ps IN TE R AC TIVE MAP S W ITH L E AFL E T IN R Rich Majer u s Assistant Vice President , Colb y College
Gro u ping Colleges b y Sector m <- ca_colleges %>% ca_public <- ipeds %>% leaflet() %>% filter(sector == "Public", addProviderTiles("CartoDB") state == "CA") m %>% m %>% addCircleMarkers( addCircleMarkers( radius = 2, data = ca_public, label = ~name) group = "Public") INTERACTIVE MAPS WITH LEAFLET IN R
m %>% addCircleMarkers( data = ca_public, color = ~pal(sector_label), group = "Public") %>% addCircleMarkers( data = ca_private, color = ~pal(sector_label), group = "Private") %>% addCircleMarkers( data = ca_profit, color = ~pal(sector_label), group = "For-Profit") INTERACTIVE MAPS WITH LEAFLET IN R
m %>% addCircleMarkers( data = ca_public, color = ~pal(sector_label), group = "Public") %>% addCircleMarkers( data = ca_private, color = ~pal(sector_label), group = "Private") %>% addCircleMarkers( data = ca_profit, color = ~pal(sector_label), group = "For-Profit") %>% addLayersControl( overlayGroups = c("Public", "Private", "For-Profit" INTERACTIVE MAPS WITH LEAFLET IN R
What We are Working To w ard INTERACTIVE MAPS WITH LEAFLET IN R
Let ' s practice ! IN TE R AC TIVE MAP S W ITH L E AFL E T IN R
Base Gro u ps IN TE R AC TIVE MAP S W ITH L E AFL E T IN R Rich Majer u s Assistant Vice President , Colb y College
Base Gro u ps and M u ltiple Map Tiles leaflet() %>% addTiles(group = "OSM") %>% addProviderTiles("CartoDB", group = "Carto") %>% addProviderTiles("Esri", group = "Esri") INTERACTIVE MAPS WITH LEAFLET IN R
leaflet() %>% addTiles(group = "OSM") %>% addProviderTiles("CartoDB", group = "Carto") %>% addProviderTiles("Esri", group = "Esri") %>% addLayersControl(baseGroups = c("OSM", "Carto", "Esri"), position = "topleft") INTERACTIVE MAPS WITH LEAFLET IN R
E x ploring Esri Base Maps INTERACTIVE MAPS WITH LEAFLET IN R
O v erla y and Base Gro u ps # initialize leaflet map leaflet() %>% # add basemaps with groups addTiles(group = "OSM") %>% addProviderTiles("CartoDB", group = "Carto") %>% addProviderTiles("Esri", group = "Esri") %>% INTERACTIVE MAPS WITH LEAFLET IN R
O v erla y and Base Gro u ps # add marker layer for each sector with corresponding group name addCircleMarkers(data = public, radius = 2, label = ~htmlEscape(name), color = ~pal(sector_label), group = "Public") %>% addCircleMarkers(data = private, radius = 2, label = ~htmlEscape(name), color = ~pal(sector_label), group = "Private") %>% addCircleMarkers(data = profit, radius = 2, label = ~htmlEscape(name), color = ~pal(sector_label), group = "For-Profit") % # add layer controls for base and overlay groups addLayersControl(baseGroups = c("OSM", "Carto", "Esri"), overlayGroups = c("Public", "Private", "For-Profit")) INTERACTIVE MAPS WITH LEAFLET IN R
The Big Re v eal INTERACTIVE MAPS WITH LEAFLET IN R
Let ' s practice ! IN TE R AC TIVE MAP S W ITH L E AFL E T IN R
Pieces of Flair IN TE R AC TIVE MAP S W ITH L E AFL E T IN R Rich Majer u s Assistant Vice President , Colb y College
The College Search ca_public <- ipeds %>% filter(sector_label == "Public", state == "CA") ca_public %>% leaflet() %>% addProviderTiles("Esri") %>% addCircleMarkers(radius = 2, label = ~htmlEscape(name), color = ~pal(sector_label), group = "Public") %>% addSearchFeatures(targetGroups = 'Public', options = searchFeaturesOptions(zoom = 10)) INTERACTIVE MAPS WITH LEAFLET IN R
# search for markers addSearchFeatures(options = addSearchFeatures( searchFeaturesOptions(zoom = 10), targetGroups = 'Public') targetGroups = 'Public') INTERACTIVE MAPS WITH LEAFLET IN R
Cl u stering Colleges ipeds %>% leaflet() %>% addTiles() %>% addCircleMarkers(radius = 2, color = ~pal(sector_label), clusterOptions = markerClusterOptions()) INTERACTIVE MAPS WITH LEAFLET IN R
Cl u stering Colleges INTERACTIVE MAPS WITH LEAFLET IN R
Let ' s practice ! IN TE R AC TIVE MAP S W ITH L E AFL E T IN R
Recommend
More recommend