{"word_count": 287, "character_count": 2255}
Yesterday, my friend Fleur did show me some interesting features of the leaflet package, in R.library(leaflet)In order to illustrate, consider locations of (fixed) radars, in several European countries. To get the data, usedownload.file("http://carte-gps-gratuite.fr/radars/zones-de-danger-destinator.zip","radar.zip")unzip("radar.zip")  ext_radar=function(nf){radar=read.table(file=paste("destinator/",nf,sep=""), sep = ",", header = FALSE, stringsAsFactors = FALSE) radar$type &#60;- sapply(radar$V3, function(x) {z=as.numeric(unlist(strsplit(x, " ")[[1]])); return(z[!is.na(z)])})  radar &#60;- radar[,c(1,2,4)]  names(radar) &#60;- c("lon", "lat", "type")  return(radar)} L=list.files("./destinator/")nl=nchar(L)id=which(substr(L,4,8)=="Radar" &#38; substr(L,nl-2,nl)=="csv") radar_E=NULLfor(i in id) radar_E=rbind(radar_E,ext_radar(L[i]))(to be honest, if you run that code, you will get several countries, but not France... but if you want to add it, you should be able to do so...). The first tool is based on popups. If you click on a point on the map, you get some information, such as the speed limit where you can find a radar. To get a nice pictogram, usefileUrl &#60;- "http://evadeo.typepad.fr/.a/6a00d8341c87ef53ef01310f9238e6970c-800wi"download.file(fileUrl,"radar.png", mode = 'wb')RadarICON &#60;- makeIcon(  iconUrl = fileUrl,   iconWidth = 20, iconHeight = 20)And then, use to following code get a dynamic map, mentionning the variable that should be used for the popupm &#60;- leaflet(data = radar_E) m &#60;- m %&#62;% addTiles() m &#60;- m %&#62;% addMarkers(~lon, ~lat, icon = RadarICON, popup = ~as.character(type))mBecause the picture is a bit heavy, with almost 20K points, let us focus only on France,The other interesting (not to say amazing) tool is a tool that creates clusters.We have here the number of radars in a neighborhood of the point we see on the map. So far, it looks like polygons used are abitrary...The code is extremely simplem &#60;- leaflet(radar_E) m &#60;- m %&#62;% addTiles()m &#60;- m %&#62;% addMarkers(~lon, ~lat, clusterOptions = markerClusterOptions())mI still wonder how we can change the polygons (e.g. using more standard administrative regions). But I have to admit that this option is awesome.