0

I started a few days ago to learn about shiny and leaflet pakages, this question is maybe irrelevant but I looked for an answer to my problem and didn't found any. Well, I am trying to create an interactive map, with a base map that I've got from internet. I would like to represent on this map the evolution of an index across the country.

stypof <- readOGR(dsn = "C:/Users/N4XW6M/Desktop/nouvelle map/fonds typo propre.TAB", layer = "fonds typo propre", stringsAsFactors = FALSE)
names(stypof@data)<-c("typo") 

fond<-data.frame(stypof@data$typo)
names(fond)<-c("typo")
new_indice_mois <- sqldf("SELECT indice_mois.*
                         FROM indice_mois, fond
                         WHERE indice_mois.typo = fond.typo")


stypof$indice_fevrier <- new_indice_mois$indice_fevrier


leaflet(stypof) %>%
  addPolygons(
    stroke = FALSE, fillOpacity = 0.5, smoothFactor = 0.5,
    color = ~colorQuantile("YlOrRd", stypof@data$indice_fevrier)(indice_fevrier)
  )

In a first step I import the base map using readOGR. Some areas are not represented in the base map that's why I use the sqldf function, then I add the index (indice_fevrier) to the map and try to use the leaflet function. I get no error message only an empty map. I tryed some other examples that I found on internet and I always have the same issue the map doesn't appear.

G.C.Skander
  • 1
  • 1
  • 2

1 Answers1

0

According to this post, you have to click on "Show in new Window" for the map to show.

Community
  • 1
  • 1
YaFred
  • 9,698
  • 3
  • 28
  • 40
  • thank you for your answer, it made it work for the example used in r studio web site but not with my map I will try to figure out where the problem comes from – G.C.Skander Jun 20 '16 at 12:29