Gis

Spatial correlation between rasters using 'terra'

In this blog article, I propose a way to look at the spatial repartition of correlation between two rasters. This is an update of a blog post I wrote in 2018 : Spatial correlation between rasters. The main difference is that I use the new {terra} package instead of the old {raster} package. The …

Read more

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

Spatial correlation between rasters

In this blog article, I propose a way to look at the spatial repartition of correlation between two rasters. For your own reason, you may want to know the correlation between rasters, but a unique value issued from fonction cor is not enough. You would like to know if there are variations of …

Read more

Spatial interpolation on Earth as a 3D sphere

Earth map is usually presented flat. Geographical coordinates usually go from -180° to +180°. Spatial interpolations using coordinates may be tricky as -180° is equal to +180°. Here I propose a way to realize spatial interpolations on Earth as a sphere and then map the outputs in 3D using rgl. The …

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

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

##Plot an image pattern in a delimited polygon […] Let us define a SpatialPolygonsDataFrame to work on. Let’s also define the specific polygon in which to draw the forest. […] ###Draw a point grid with emoji in a specific polygon We can sample points in the polygon area using …

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

Mapping, spatial analyses and GIS with R

If you download the following presentation, you will find a presentation of different functions in the R-software useful for spatial data manipulations. Choosing the right libraries allows to create, import, modify, manipulate and map vector (shapefiles) or matrix (raster) spatial data. Your spatial …

Read more