33 lines
893 B
R
33 lines
893 B
R
# simpleobisCCP.R
|
|
# Simple example for CCP integration
|
|
#
|
|
# Author: Giancarlo Panichi
|
|
###############################################################################
|
|
|
|
library(robis)
|
|
library(ggplot2)
|
|
library(rgeos)
|
|
|
|
#sname="Sarda sarda"
|
|
#usedPolygon="POLYGON((-5.657713322217344 45.88175260533238,38.99072417778265 45.88175260533238,38.99072417778265 29.60135866020714,-5.657713322217344 29.60135866020714,-5.657713322217344 45.88175260533238))"
|
|
result="occplot.png"
|
|
|
|
args = commandArgs(trailingOnly=TRUE)
|
|
print(args)
|
|
|
|
if (length(args)<=1) {
|
|
stop("At least two arguments must be supplied", call.=FALSE)
|
|
}
|
|
|
|
sname=args[1]
|
|
usedPolygon=args[2]
|
|
|
|
wktP <-readWKT(usedPolygon)
|
|
print(wktP@bbox)
|
|
|
|
#By scientific name adnd geometry
|
|
y=occurrence(sname, geometry = usedPolygon)
|
|
occplot<-map_ggplot(y, color = "#ff3399")+coord_sf(xlim = wktP@bbox[1,], ylim = wktP@bbox[2,])
|
|
ggsave(result, plot = occplot)
|
|
|