Gianpaolo Coro 2013-11-19 13:26:33 +00:00
parent 60380126a4
commit f89f76cf33
5 changed files with 28 additions and 4 deletions

View File

@ -58,7 +58,7 @@ public abstract class MapsCreator extends StandardLocalExternalAlgorithm {
@Override
public String getDescription() {
return "A transducer algorithm to produce a GIS map either from a probability distribution or from a set of points. A maximum of " + maxNPoints + " is allowed";
return "A transducer algorithm to produce a GIS map from a probability distribution or from a set of points. A maximum of " + maxNPoints + " is allowed";
}
@Override
@ -67,6 +67,7 @@ public abstract class MapsCreator extends StandardLocalExternalAlgorithm {
@Override
protected void process() throws Exception {
try {
status = 0;
log("Beginning process");
log("Set scope from outside:"+config.getGcubeScope());
String scope = config.getGcubeScope();
@ -91,7 +92,7 @@ public abstract class MapsCreator extends StandardLocalExternalAlgorithm {
gisconfig.setConfigPath(config.getConfigPath());
gisdbconnection = DatabaseUtils.initDBSession(gisconfig);
log("Initialized gisDBConnection!");
status = 10;
// connect to the SM DB
smdbconnection = DatabaseUtils.initDBSession(config);
log("Initialized SMDBConnection!");
@ -133,7 +134,7 @@ public abstract class MapsCreator extends StandardLocalExternalAlgorithm {
//GIS Table creation
log("Creating GIS table");
String gisTableName = "stat" + UUID.randomUUID().toString().replace("-", "");
status = 30;
String createTable$ = String.format(createProbTable, gisTableName);
String columnNames$ = columnsProbNames;
if (config.getParam(probabilityParameter)==null){
@ -170,6 +171,7 @@ public abstract class MapsCreator extends StandardLocalExternalAlgorithm {
values.add(selements);
i++;
}
status = 50;
log("Writing chunks");
// write chunks into the DB
insertGeoChunksIntoTable(gisTableName, columnNames$, values, 5000, gisdbconnection);
@ -180,6 +182,7 @@ public abstract class MapsCreator extends StandardLocalExternalAlgorithm {
String layerName = config.getParam(layerNameParameter);
PublishResponse response = PolyMapMetadata.publishTable(scope, gisTableName, resolution, username, layerName, defaultStyle, workspace, datastore, purpose, credits, keyword);
status = 80;
//analyzing response
if (response == null) {
log("Error in generating map - dropping gis table");
@ -202,7 +205,7 @@ public abstract class MapsCreator extends StandardLocalExternalAlgorithm {
}
log("Output:"+outputParameters);
log("All Done!");
status = 100;
} catch (Exception e) {
e.printStackTrace();
throw e;

View File

@ -11,6 +11,11 @@ import org.gcube.dataanalysis.ecoengine.datatypes.enumtypes.TableTemplates;
public class PointsMapsCreator extends MapsCreator {
@Override
public String getDescription() {
return "A transducer algorithm to produce a GIS map of points from a set of points with x,y coordinates indications. A maximum of " + maxNPoints + " is allowed";
}
@Override
public void init() throws Exception {
log("MAPS_CREATOR");

View File

@ -11,6 +11,12 @@ import org.gcube.dataanalysis.ecoengine.datatypes.enumtypes.TableTemplates;
public class PolygonMapsCreator extends MapsCreator {
@Override
public String getDescription() {
return "A transducer algorithm to produce a GIS map of filled polygons associated to x,y coordinates and a certain resolution. A maximum of " + maxNPoints + " is allowed";
}
@Override
public void init() throws Exception {
log("MAPS_CREATOR");

View File

@ -11,6 +11,11 @@ import org.gcube.dataanalysis.ecoengine.datatypes.enumtypes.TableTemplates;
public class SpeciesDistributionsMapsCreatorFromCsquares extends MapsCreator {
@Override
public String getDescription() {
return "A transducer algorithm to produce a GIS map from a probability distribution associated to a set of csquare codes. A maximum of " + maxNPoints + " is allowed";
}
@Override
public void init() throws Exception {
log("MAPS_CREATOR");

View File

@ -11,6 +11,11 @@ import org.gcube.dataanalysis.ecoengine.datatypes.enumtypes.TableTemplates;
public class SpeciesDistributionsMapsCreatorFromPoints extends MapsCreator {
@Override
public String getDescription() {
return "A transducer algorithm to produce a GIS map from a probability distribution made upf of x,y coordinates and a certain resolution. A maximum of " + maxNPoints + " is allowed";
}
@Override
public void init() throws Exception {
log("MAPS_CREATOR");