r-leaflet

Introduction to mapping with {sf} & Co.

At the “Rencontres R 2018” in Rennes, I proposed a brief introduction to mapping using the recent {sf} package and some other interesting packages. This blog post is an extended version of my presentation allowing me to share the code of the different maps that appeared on it. It’s still a brief …

Read more

Polygons tint band with leaflet and simple feature (library sf)

Let’s use some French regions polygons and attribute one colour to each region. I like piratepal colours of library yarrr. […] To create the doughnuts using original and buffer polygons, I used st_difference. However as discussed with edzer in the sf github repository, I had to transform the …

Read more

How to fill a hatched area polygon with holes in leaflet with R

I built a R package, available on my statnmap github, to provide the function hatched.SpatialPolygons. This function is based on the plot method for SpatialPolygons of library sp. I modified the functions and sub-functions to remove all code for direct drawing and allow to output a …

Read more

Add multiple layers in leaflet widget with R

Library leaflet with R is well integrated with pipe writing (%>%). Thus, it is really easy to add multiple layers and options in a leaflet widget. If you want to add a lot of layers in your widget, it is not necessary to provide a “addPolygons” for each of these layers, you can simply use a loop. …

Read more