Spatial

Add {tmap} point layer with multiple symbol border colors and width

It’s been a while since my last blog post. Indeed, my free time is used to improve packages like “{fusen}: Inflate your package from a simple flat Rmd” , “{attachment}: Tools to deal with dependencies in scripts, Rmd and packages” or “{gitlabr}: An R client for the GitLab API”. Hence, drawing some …

Read more

Buffer areas for nearest neighbours or national marine areas delineation

A few weeks ago, Christina Buelow asked on Twitter how she could create the polygons of coastal waters using the land polygons, and making sure there is no overlap in buffer areas. This would make it possible to know which land area is closest to any place in the sea. Let’s explore what solution …

Read more

Find most retweeted tweets of the #rspatial bot

Bots that retweet #rspatial and #BioImageAnalysis tweets are working well. It is now time to add a little functionnality with the best retweeted tweet of the month, a function added to {tweetrbot} package. […] You can retrieve the updated dataset for all tweets here and the dataset for the …

Read more

Create a twitter bot on a Raspberry Pi 3 using R

With Marion Louveaux, we decided that we had to build a Twitter bot for our preferred hashtag. We explored different possibilities but truth is I couldn’t resist building it using R and {rtweet}. Here are the steps I used to set up a Twitter bot on my Raspberry Pi. […] I use package {rtweet} …

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

Bayesian life cycle model: OpenBUGS code

The OpenBUGS code presented below is the additional material of a publication. This is the life cycle model of a marine species (the sole in the Eastern Channel). The Bayesian hierarchical model incorporates indices of juvenile spatialized abundance, larval dispersion, adult abundance indices and …

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