52North WPS interface for Atlas i1 SpeciesByOcean
Norbert IRD edited this page Apr 14, 2014
·
1 revision
R script for interface with an 52North WPS server
#Atlas_i1_SpeciesByOcean : build a graph of catches by ocean and by year
#52North WPS annotations
# wps.des: id = Atlas_i1_SpeciesByOcean, title = IRD tuna atlas indicator i1, abstract = Graph of species catches by ocean;
# wps.in: id = data_type, type = string, title = Data type (csv or WFS or MDSTServer), value = "WFS";
# wps.in: id = url, type = string, title = Data URL, value = "http://mdst-macroes.ird.fr:8080/constellation/WS/wfs/tuna_atlas";
# wps.in: id = layer, type = string, title = Data layer name, minOccurs = 0, maxOccurs = 1, value = "ns11:i1i2_mv";
# wps.in: id = mdst_query, type = string, title = MDSTServer query. Only used with MDSTServer data type, minOccurs = 0, maxOccurs = 1;
# wps.in: id = ogc_filter, type = string, title = OGC filter to apply on a WFS datasource. Only used with WFS data type, minOccurs = 0, maxOccurs = 1;
# wps.in: id = connection_type, type = string, title = Data connection type (local or remote), value = "remote";
# wps.in: id = withEcoscopeSparql, type = string, title = Use the ecoscope.org sparql queries, value = "true";
# wps.in: id = datasetYearAttributeName, type = string, title = Year attribute name in the input dataset, value = "year";
# wps.in: id = datasetOceanAttributeName, type = string, title = Ocean attribute name in the input dataset, value = "ocean";
# wps.in: id = datasetSpeciesAttributeName, type = string, title = Species attribute name in the input dataset, value = "species";
# wps.in: id = datasetValueAttributeName, type = string, title = Value attribute name in the input dataset, value = "value";
# wps.out: id = result, type = string, title = List of result files path;
if(! require(IRDTunaAtlas)) {
stop("Missing IRDTunaAtlas library")
}
#read the input data
dataset <- readData(connectionType=connection_type,
dataType=data_type,
url=url,
layer=layer,
MDSTQuery=mdst_query,
ogcFilter=ogc_filter)
#do the mapping of dataset attributes names
dataset <- evaluateAndRenameAttributesNames(df=dataset, objList=ls())
#Build the indicator
resultDF <- Atlas_i1_SpeciesByOcean(df=dataset, withSparql=withEcoscopeSparql=="true")
if(! require(rjson)) {
stop("Missing rjson library")
}
result <- toJSON(resultDF)