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

Stackoverflow is again a source of inspiration. I found this question on tint bands in leaflet, not related to R originally but I though I could answer it with R easily. This is also a good one for me to play with this new simple feature library sf and use it with leaflet. My simple solution is to …

Read more

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

Drawing polygons filled with a hatched background is quite easy with classical plot in R. This only requires to define density and angle parameters of polygon function. SpatialPolygons from library sp also uses this polygon function. However, if you want to draw a hatched area of a SpatialPolygons …

Read more

Plot a specific image in a delimited polygon as repeated pattern on a map

A question on stackoverflow asked how to draw trees in a polygon to represent a forest area on a map. I first thought about plotting “emoji” on a regular point pattern sampled in the polygon. Library sp allows for sampling points in a delimited SpatialPolygons which was exactly what I was looking …

Read more