forked from gCubeSystem/simpleobismaps
Added support to create zip file
This commit is contained in:
parent
bad7d296d0
commit
7f1f1502d4
|
@ -1,9 +1,6 @@
|
|||
# SimpleOBISMaps
|
||||
|
||||
SimpleOBISMaps is an example written in R that allows you to create an image of the occurrences present in OBIS starting from a file that contains the scientific names and a polygon.
|
||||
|
||||
As can be seen, there are 2 scripts, one to be integrated with the SAI simpleobismapsSAI.R and the other with the CCP simpleobismapsCCP.R.
|
||||
The differences are few between the two scripts only that the CPP takes the parameters directly from the command line.
|
||||
SimpleOBISMaps is an example written in R that allows you to create a set of maps packaged in a zip file called maps.zip. This maps describe the occurrences present in OBIS starting from a file that contains the scientific names and a polygon.
|
||||
|
||||
Starting from this example, you can first create a docker image in which it is installed the file simpleobismapsCCP.R.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# simpleobisCCP.R
|
||||
# simpleobismapsCCP.R
|
||||
# Simple example for CCP integration
|
||||
#
|
||||
# Author: Giancarlo Panichi
|
||||
|
@ -8,10 +8,11 @@ library(robis)
|
|||
library(ggplot2)
|
||||
library(rgeos)
|
||||
library(stringr)
|
||||
library(utils)
|
||||
|
||||
createplot <- function(sname,usedPolygon){
|
||||
result = tryCatch({
|
||||
result=paste("/ccp_data/",sname,".png",sep="")
|
||||
result=paste("/ccp_data/maps/",sname,".png",sep="")
|
||||
|
||||
wktP <-readWKT(usedPolygon)
|
||||
print(wktP@bbox)
|
||||
|
@ -45,6 +46,13 @@ readfile <- function(filename, usedPolygon) {
|
|||
close(con)
|
||||
}
|
||||
|
||||
checkmapsfolder <- function(){
|
||||
if (!dir.exists("/ccp_data/maps")){
|
||||
dir.create("/ccp_data/maps")
|
||||
}else{
|
||||
print("maps dir exists")
|
||||
}
|
||||
}
|
||||
|
||||
#url="https://data.d4science.net/Y8WK"
|
||||
#usedPolygon="POLYGON((-5.657713322217344 45.88175260533238,38.99072417778265 45.88175260533238,38.99072417778265 29.60135866020714,-5.657713322217344 29.60135866020714,-5.657713322217344 45.88175260533238))"
|
||||
|
@ -60,9 +68,13 @@ main <- function(){
|
|||
|
||||
url=args[1]
|
||||
usedPolygon=args[2]
|
||||
download.file(url, filename)
|
||||
mapszip="maps.zip"
|
||||
|
||||
download.file(url, filename)
|
||||
checkmapsfolder()
|
||||
readfile(filename,usedPolygon)
|
||||
zip(zipfile = mapszip, files = "ccp_data/maps")
|
||||
|
||||
}
|
||||
|
||||
main()
|
||||
|
|
Loading…
Reference in New Issue