We need the following R libraries:


Load equal area rasters and crop with the extent of Europe

We use the package ‘sdmpredictors’ to load environmental data layers from Bio-ORACLE and Marspec.

# Inspect the available datasets and layers
datasets <- list_datasets(terrestrial = FALSE, marine = TRUE)
layers <- list_layers(datasets)

We select a limited number of layers for this exercise and crop these to a European extent.

layercodes <- c("MS_biogeo05_dist_shore_5m", "MS_bathy_5m", 
                "BO_sstrange", "BO_sstmean", "BO_salinity")
env <- load_layers(layercodes, equalarea = TRUE)
europe <- raster::crop(env, extent(-12e5,25e5, 45e5, 70e5))

# Data sources
## [1] "Tyberghein L, Heroen V, Pauly K, Troupin C, Mineur F and De Clerck O (2012). \"Bio-ORACLE: a global environmental dataset for marine\nspecies distribution modelling.\" _Global Ecology and\nBiogeography_, *21*(2), pp. 272-281. doi:\n10.1111/j.1466-8238.2011.00656.x (URL:\n"
## [2] "Sbrocco EJ and Barber PH (2013). \"MARSPEC: ocean climate layers for marine spatial ecology.\" _Ecology_, *94*(4), pp. 979. doi:\n10.1890/12-1358.1 (URL:"

Fetch occurrence data for Sepia officinalis

We use the Emodnet Biology webservice to download the using a Geoserver web service. You can find this service URL as follows:

  1. Go to

  2. Search for ‘Sepia officinalis’ in the Taxonomic Search section.

  3. Click on the ‘+’ button. You can now see your selection in the window on the right. Click ‘next’.

  4. Go to ‘Actions’ and select ‘Get webservice URL’. There you go.

occ <- read.csv("")

Species Distribution model

We using the ‘zoon’ package to create a random forest model for the selected species. This is only an example so please be carefull with the interpretation of the result.

## preparation for zoon workflow
points <- SpatialPoints(occ[,c("longitude", "latitude")], lonlatproj)
points <- spTransform(points, equalareaproj)
occfile <- tempfile(fileext = ".csv")
write.csv(cbind(coordinates(points), value=1), occfile)

## workflow

  occurrence = LocalOccurrenceData(
    occfile, occurrenceType="presence",
    columns = c("longitude", "latitude", "value")), 
  covariate = LocalRaster(stack(europe)),
  process = OneHundredBackground(seed = 73),
  model = RandomForest,
  output = PrintMap)