Showing posts with label Species Distribution. Show all posts
Showing posts with label Species Distribution. Show all posts

Sunday, September 20, 2015

Retrieve GBIF Species Occurrence Data with Function from dismo Package

..The dismo package is awesome: with some short lines of code you can read & map species distribution data from GBIF (the global biodiversity information facility) easily:






library(dismo)

# get GBIF data with function:
myrger <- gbif("Myricaria", "germanica", geo = T)

# check:
str(myrger)

# plot occurrences:
library(maptools)
data(wrld_simpl)
plot(wrld_simpl, col = "light yellow", axes = T)
points(myrger$lon, myrger$lat, col = "red", cex = 0.5)
text(-140, -50, "MYRICARIA\nGERMANICA")
Read more »

Nice Species Distribution Maps with GBIF-Data in R

Here's an example of how to easily produce real nice distribution maps from GBIF-data in R with package maps...















# go to gbif and download a csv file with the species you 
# want (example data)
# ..in R first set working directory to your download directory..
data <- read.csv("occurrence-search-1316347695527.CSV",
header = T, sep = ",")

str(data)
require(maps)
pdf("myr_germ.pdf")
map("world", resolution = 75)
points(data$Longitude, data$Latitude, col = 2, cex = 0.05)
text(-140, -50, "MYRICARIA\nGERMANICA")
dev.off()

# that's all there is to it..
Read more »

A Simple Example for the Use of Shapefiles in R

A simple example for drawing an occurrence-map (polygons with species' points) with the R-packages maptools and sp using shapefiles.
HERE is the example data.








library(maptools)
library(sp)

# Note that for each shapefile, you only need to read the .shp component
# the others will be read in at the same time automatically.
# TIRIS.BEZIDX_PL.shp contains the political districts of North-Tyrol
# Limodorum.shp contains points with occurences of the plant species
# Limodorum abortivum.
# Note that my layers use the same geographic coordinate systems (gcs),
# using other data you would need to check if the gcs and
# projection of all layers are the same!

# set dir to where you downloaded the data:
setwd("E:/R/Data/Maps/Example.1_Data")
Limodorum.shp <- readShapePoints(file.choose())
TIRIS.BEZIDX_PL.shp <- readShapePoly(file.choose())

# examine points:
summary(Limodorum.shp)
attributes(Limodorum.shp@data)

# examine polygons:
summary(TIRIS.BEZIDX_PL.shp)
attributes(TIRIS.BEZIDX_PL.shp@data)

# limits:
# to customize ylim in plot-call
# seems not to work here...
xlim <- TIRIS.BEZIDX_PL.shp@bbox[1, ]
ylim <- TIRIS.BEZIDX_PL.shp@bbox[2, ]

par(mai = rep(.1, 4))

plot(TIRIS.BEZIDX_PL.shp, col = "grey93", axes = F,
xlim = xlim, ylim = ylim, bty = "n")
points(Limodorum.shp, pch = 16,
col = 2, cex = .5)
mtext("Limodorum abortivum", 3, line = -7,
at = -17000, adj = 0, cex = 2, font = 3)
legend("bottomleft", inset = c(0.4, 0.2),
legend = c("Fundpunkte", "Polit. Bezirke"),
bty = "n", pch = c(16,-1), # bty = "n": no box
col = c(2, 1), pt.cex = c(.5, 1),
lty = c(-1, 1))


To cite package ‘maptools’ in publications use:

  Nicholas J. Lewin-Koh, Roger Bivand, contributions by Edzer J.
  Pebesma, Eric Archer, Adrian Baddeley, Hans-Jörg Bibiko, Stéphane
  Dray, David Forrest, Michael Friendly, Patrick Giraudoux, Duncan
  Golicher, Virgilio Gómez Rubio, Patrick Hausmann, Karl Ove
  Hufthammer, Thomas Jagger, Sebastian P. Luque, Don MacQueen, Andrew
  Niccolai, Tom Short, Ben Stabler and Rolf Turner (2011). maptools:
  Tools for reading and handling spatial objects. R package version
  0.8-10. http://CRAN.R-project.org/package=maptools


To cite package ‘sp’ in publications use:

  Pebesma, E.J., R.S. Bivand, 2005. Classes and methods for spatial
  data in R. R News 5 (2), http://cran.r-project.org/doc/Rnews/.

  Roger S. Bivand, Edzer J. Pebesma, Virgilio Gomez-Rubio, 2008.
  Applied spatial data analysis with R. Springer, NY.
  http://www.asdar-book.org/
Read more »