How to create an interactive map

with the SKEMA Quantum Studio framework

Anne Sophie Gill https://www.skemagloballab.io/gillAnneSophie.html (SKEMA Global Lab in AI)https://skemagloballab.io , Marine Leroi https://www.skemagloballab.io/leroiMarine.html (SKEMA Global Lab in AI)https://skemagloballab.io , Martin Paquette https://www.skemagloballab.io/paquetteMartin.html (SKEMA Global Lab in AI)https://skemagloballab.io , Thierry Warin https://www.nuance-r.com/principalInvestigator.html (SKEMA Business School (Raleigh, NC))https://www.skemagloballab.io
01-28-2020

Using the SKEMA Quantum Studio(Warin 2019) framework, we are going to teach you how to create basic interactive maps.

Open the following packages


library(leaflet)
library(dplyr)

Create your interactive map

Montreal


# Create your map widget

leaflet() %>% 
setView(lng = -73.5673, lat = 45.5017, zoom = 12) %>% 

# Add layers to your map by using layer functions to modify the map widget. 
# You can have as many or as little layers as you want

  addProviderTiles(providers$Esri.NatGeoWorldMap) %>%  # add ProviderTiles
    
  addMarkers(lng=-73.582189, lat=45.517958, popup="SKEMA Global Lab in AI") %>% # add Markers
  
  addScaleBar() %>% # add ScaleBar
    
  addMiniMap() # add MiniMap

Leaflet provides a lot of different Tiles. You can find them here.


Here is another example of interactive map.

Melbourne


# Create custom icon to add to your layer
  
koalaIcon <- makeIcon(
  iconUrl = "koala.png",
  iconWidth = 70, iconHeight = 70,
  iconAnchorX = 22, iconAnchorY = 94
)

# Open packages

library(leaflet)
library(dplyr)

# Create Map Widget

leaflet() %>% 
  setView(lng = 144.9631, lat = -37.8136, zoom = 11) %>%  
  addProviderTiles(providers$Stamen.Watercolor) %>% # Stamen Watercolor Theme
  addMarkers(lng= 144.9632, lat= -37.8135, popup="Melbourne", icon = koalaIcon) %>% # Custom Icon 
  addScaleBar() %>% 
  addMiniMap()

And that is how you create basic interactive maps ! For more information about interactive maps, visit Leaflet


Follow SKEMA Global Lab in Augmented Intelligence

Warin, Thierry. 2019. “SKEMA Quantum Studio: A Technological Framework for Data Science in Higher Education.” https://doi.org/10.6084/m9.figshare.8204195.v2.

Citation

For attribution, please cite this work as

Gill, et al. (2020, Jan. 28). Blog: How to create an interactive map. Retrieved from https://blog.skemagloballab.io/posts/2020-01-28-interactiveMaps/

BibTeX citation

@misc{gill2020how,
  author = {Gill, Anne Sophie and Leroi, Marine and Paquette, Martin and Warin, Thierry},
  title = {Blog: How to create an interactive map},
  url = {https://blog.skemagloballab.io/posts/2020-01-28-interactiveMaps/},
  year = {2020}
}