-
Notifications
You must be signed in to change notification settings - Fork 0
52North WPS interface for Atlas i2 SpeciesByGear
Norbert IRD edited this page Apr 14, 2014
·
2 revisions
R script for interface with an 52North WPS server
#Atlas_i2_SpeciesByGear : build a graph of catches by gear type and by year
#52North WPS annotations
# wps.des: id = Atlas_i2_SpeciesByGear, title = IRD tuna atlas indicator i2, abstract = Graph of species catches by gear type;
# 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 = year_attribute_name, type = string, title = Year attribute name in the input dataset, value="year";
# wps.in: id = gear_attribute_name, type = string, title = Gear type attribute name in the input dataset, value="gear_type";
# wps.in: id = species_attribute_name, type = string, title = Species attribute name in the input dataset, value="species";
# wps.in: id = value_attribute_name, type = string, title = Value attribute name in the input dataset, value="value";
# wps.out: id = result, type = string, title = result files path list;
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_i2_SpeciesByGear(df=dataset, withSparql=withEcoscopeSparql=="true")
if(! require(rjson)) {
stop("Missing rjson library")
}
result <- toJSON(resultDF)