git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/EcologicalEngineGeoSpatialExtension@85690 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
60380126a4
commit
f89f76cf33
|
@ -58,7 +58,7 @@ public abstract class MapsCreator extends StandardLocalExternalAlgorithm {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDescription() {
|
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
|
@Override
|
||||||
|
@ -67,6 +67,7 @@ public abstract class MapsCreator extends StandardLocalExternalAlgorithm {
|
||||||
@Override
|
@Override
|
||||||
protected void process() throws Exception {
|
protected void process() throws Exception {
|
||||||
try {
|
try {
|
||||||
|
status = 0;
|
||||||
log("Beginning process");
|
log("Beginning process");
|
||||||
log("Set scope from outside:"+config.getGcubeScope());
|
log("Set scope from outside:"+config.getGcubeScope());
|
||||||
String scope = config.getGcubeScope();
|
String scope = config.getGcubeScope();
|
||||||
|
@ -91,7 +92,7 @@ public abstract class MapsCreator extends StandardLocalExternalAlgorithm {
|
||||||
gisconfig.setConfigPath(config.getConfigPath());
|
gisconfig.setConfigPath(config.getConfigPath());
|
||||||
gisdbconnection = DatabaseUtils.initDBSession(gisconfig);
|
gisdbconnection = DatabaseUtils.initDBSession(gisconfig);
|
||||||
log("Initialized gisDBConnection!");
|
log("Initialized gisDBConnection!");
|
||||||
|
status = 10;
|
||||||
// connect to the SM DB
|
// connect to the SM DB
|
||||||
smdbconnection = DatabaseUtils.initDBSession(config);
|
smdbconnection = DatabaseUtils.initDBSession(config);
|
||||||
log("Initialized SMDBConnection!");
|
log("Initialized SMDBConnection!");
|
||||||
|
@ -133,7 +134,7 @@ public abstract class MapsCreator extends StandardLocalExternalAlgorithm {
|
||||||
//GIS Table creation
|
//GIS Table creation
|
||||||
log("Creating GIS table");
|
log("Creating GIS table");
|
||||||
String gisTableName = "stat" + UUID.randomUUID().toString().replace("-", "");
|
String gisTableName = "stat" + UUID.randomUUID().toString().replace("-", "");
|
||||||
|
status = 30;
|
||||||
String createTable$ = String.format(createProbTable, gisTableName);
|
String createTable$ = String.format(createProbTable, gisTableName);
|
||||||
String columnNames$ = columnsProbNames;
|
String columnNames$ = columnsProbNames;
|
||||||
if (config.getParam(probabilityParameter)==null){
|
if (config.getParam(probabilityParameter)==null){
|
||||||
|
@ -170,6 +171,7 @@ public abstract class MapsCreator extends StandardLocalExternalAlgorithm {
|
||||||
values.add(selements);
|
values.add(selements);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
status = 50;
|
||||||
log("Writing chunks");
|
log("Writing chunks");
|
||||||
// write chunks into the DB
|
// write chunks into the DB
|
||||||
insertGeoChunksIntoTable(gisTableName, columnNames$, values, 5000, gisdbconnection);
|
insertGeoChunksIntoTable(gisTableName, columnNames$, values, 5000, gisdbconnection);
|
||||||
|
@ -180,6 +182,7 @@ public abstract class MapsCreator extends StandardLocalExternalAlgorithm {
|
||||||
|
|
||||||
String layerName = config.getParam(layerNameParameter);
|
String layerName = config.getParam(layerNameParameter);
|
||||||
PublishResponse response = PolyMapMetadata.publishTable(scope, gisTableName, resolution, username, layerName, defaultStyle, workspace, datastore, purpose, credits, keyword);
|
PublishResponse response = PolyMapMetadata.publishTable(scope, gisTableName, resolution, username, layerName, defaultStyle, workspace, datastore, purpose, credits, keyword);
|
||||||
|
status = 80;
|
||||||
//analyzing response
|
//analyzing response
|
||||||
if (response == null) {
|
if (response == null) {
|
||||||
log("Error in generating map - dropping gis table");
|
log("Error in generating map - dropping gis table");
|
||||||
|
@ -202,7 +205,7 @@ public abstract class MapsCreator extends StandardLocalExternalAlgorithm {
|
||||||
}
|
}
|
||||||
log("Output:"+outputParameters);
|
log("Output:"+outputParameters);
|
||||||
log("All Done!");
|
log("All Done!");
|
||||||
|
status = 100;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw e;
|
throw e;
|
||||||
|
|
|
@ -11,6 +11,11 @@ import org.gcube.dataanalysis.ecoengine.datatypes.enumtypes.TableTemplates;
|
||||||
|
|
||||||
public class PointsMapsCreator extends MapsCreator {
|
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
|
@Override
|
||||||
public void init() throws Exception {
|
public void init() throws Exception {
|
||||||
log("MAPS_CREATOR");
|
log("MAPS_CREATOR");
|
||||||
|
|
|
@ -11,6 +11,12 @@ import org.gcube.dataanalysis.ecoengine.datatypes.enumtypes.TableTemplates;
|
||||||
|
|
||||||
public class PolygonMapsCreator extends MapsCreator {
|
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
|
@Override
|
||||||
public void init() throws Exception {
|
public void init() throws Exception {
|
||||||
log("MAPS_CREATOR");
|
log("MAPS_CREATOR");
|
||||||
|
|
|
@ -11,6 +11,11 @@ import org.gcube.dataanalysis.ecoengine.datatypes.enumtypes.TableTemplates;
|
||||||
|
|
||||||
public class SpeciesDistributionsMapsCreatorFromCsquares extends MapsCreator {
|
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
|
@Override
|
||||||
public void init() throws Exception {
|
public void init() throws Exception {
|
||||||
log("MAPS_CREATOR");
|
log("MAPS_CREATOR");
|
||||||
|
|
|
@ -11,6 +11,11 @@ import org.gcube.dataanalysis.ecoengine.datatypes.enumtypes.TableTemplates;
|
||||||
|
|
||||||
public class SpeciesDistributionsMapsCreatorFromPoints extends MapsCreator {
|
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
|
@Override
|
||||||
public void init() throws Exception {
|
public void init() throws Exception {
|
||||||
log("MAPS_CREATOR");
|
log("MAPS_CREATOR");
|
||||||
|
|
Loading…
Reference in New Issue