adjusted maps comparison
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/EcologicalEngineGeoSpatialExtension@97863 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
0d615fe1a8
commit
6036b6dfe5
|
@ -1,10 +1,14 @@
|
||||||
package org.gcube.dataanalysis.geo.algorithms;
|
package org.gcube.dataanalysis.geo.algorithms;
|
||||||
|
|
||||||
import java.awt.Image;
|
import java.awt.Image;
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.DriverManager;
|
||||||
|
import java.sql.Statement;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
import org.gcube.contentmanagement.graphtools.data.conversions.ImageTools;
|
import org.gcube.contentmanagement.graphtools.data.conversions.ImageTools;
|
||||||
|
@ -21,11 +25,14 @@ import org.gcube.dataanalysis.ecoengine.evaluation.DiscrepancyAnalysis;
|
||||||
import org.gcube.dataanalysis.ecoengine.interfaces.DataAnalysis;
|
import org.gcube.dataanalysis.ecoengine.interfaces.DataAnalysis;
|
||||||
import org.gcube.dataanalysis.ecoengine.utils.DatabaseUtils;
|
import org.gcube.dataanalysis.ecoengine.utils.DatabaseUtils;
|
||||||
import org.gcube.dataanalysis.ecoengine.utils.IOHelper;
|
import org.gcube.dataanalysis.ecoengine.utils.IOHelper;
|
||||||
|
import org.gcube.dataanalysis.ecoengine.utils.Operations;
|
||||||
import org.gcube.dataanalysis.geo.connectors.netcdf.NetCDFDataExplorer;
|
import org.gcube.dataanalysis.geo.connectors.netcdf.NetCDFDataExplorer;
|
||||||
|
import org.gcube.dataanalysis.geo.connectors.wfs.WFS;
|
||||||
import org.gcube.dataanalysis.geo.infrastructure.GeoNetworkInspector;
|
import org.gcube.dataanalysis.geo.infrastructure.GeoNetworkInspector;
|
||||||
import org.gcube.dataanalysis.geo.matrixmodel.MatrixExtractor;
|
import org.gcube.dataanalysis.geo.matrixmodel.MatrixExtractor;
|
||||||
import org.gcube.dataanalysis.geo.matrixmodel.RasterTable;
|
import org.gcube.dataanalysis.geo.matrixmodel.RasterTable;
|
||||||
import org.gcube.dataanalysis.geo.matrixmodel.XYExtractor;
|
import org.gcube.dataanalysis.geo.matrixmodel.XYExtractor;
|
||||||
|
import org.hibernate.SessionFactory;
|
||||||
import org.jfree.chart.JFreeChart;
|
import org.jfree.chart.JFreeChart;
|
||||||
import org.jfree.data.function.NormalDistributionFunction2D;
|
import org.jfree.data.function.NormalDistributionFunction2D;
|
||||||
import org.jfree.data.general.DatasetUtilities;
|
import org.jfree.data.general.DatasetUtilities;
|
||||||
|
@ -56,7 +63,7 @@ public class MapsComparator extends DataAnalysis {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return "An algorithm for comparing two OGC/NetCDF maps in seamless way to the user. The algorithm assesses the similarities between two geospatial maps by comparing them in a point-to-point fashion. It accepts as input the two geospatial maps (via their UUIDs in the infrastructure spatial data repository - recoverable through the Geoexplorer portlet) and some parameters affecting the comparison such as the z-index, the time index, the comparison threshold.";
|
return "An algorithm for comparing two OGC/NetCDF maps in seamless way to the user. The algorithm assesses the similarities between two geospatial maps by comparing them in a point-to-point fashion. It accepts as input the two geospatial maps (via their UUIDs in the infrastructure spatial data repository - recoverable through the Geoexplorer portlet) and some parameters affecting the comparison such as the z-index, the time index, the comparison threshold. Note: in the case of WFS layers it makes comparisons on the last feature column.";
|
||||||
}
|
}
|
||||||
|
|
||||||
public double BBxLL = -180;
|
public double BBxLL = -180;
|
||||||
|
@ -120,33 +127,42 @@ public class MapsComparator extends DataAnalysis {
|
||||||
|
|
||||||
AnalysisLogger.getLogger().debug("MapsComparator: ****Rasterizing map 1****");
|
AnalysisLogger.getLogger().debug("MapsComparator: ****Rasterizing map 1****");
|
||||||
double[][] slice1 = intersector.extractXYGrid(layerT1, time1, BBxLL, BBxUR, BByLL, BByUR, z, resolution, resolution);
|
double[][] slice1 = intersector.extractXYGrid(layerT1, time1, BBxLL, BBxUR, BByLL, BByUR, z, resolution, resolution);
|
||||||
|
HashMap<Double,Map<String, String>> polygonsFeatures = null;
|
||||||
|
if (intersector.currentconnector instanceof WFS)
|
||||||
|
polygonsFeatures = ((WFS) intersector.currentconnector).getPolygonsFeatures();
|
||||||
|
|
||||||
AnalysisLogger.getLogger().debug("MapsComparator: Dumping map 1");
|
AnalysisLogger.getLogger().debug("MapsComparator: Dumping map 1");
|
||||||
status = 30;
|
status = 30;
|
||||||
RasterTable raster1 = new RasterTable(BBxLL, BBxUR, BByLL, BByUR, z, resolution, resolution, slice1, config);
|
RasterTable raster1 = new RasterTable(BBxLL, BBxUR, BByLL, BByUR, z, resolution, resolution, slice1, polygonsFeatures,config);
|
||||||
raster1.dumpGeoTable();
|
raster1.dumpGeoTable();
|
||||||
String rastertable1 = raster1.getTablename();
|
String rastertable1 = raster1.getTablename();
|
||||||
AnalysisLogger.getLogger().debug("MapsComparator: Map 1 was dumped in table: " + rastertable1);
|
AnalysisLogger.getLogger().debug("MapsComparator: Map 1 was dumped in table: " + rastertable1);
|
||||||
status = 40;
|
status = 40;
|
||||||
|
String columnToCompare1 = assessComparisonColumn(intersector, raster1);
|
||||||
intersector = new XYExtractor (config);
|
intersector = new XYExtractor (config);
|
||||||
AnalysisLogger.getLogger().debug("MapsComparator: ****Rasterizing map 2****");
|
AnalysisLogger.getLogger().debug("MapsComparator: ****Rasterizing map 2****");
|
||||||
double[][] slice2 = intersector.extractXYGrid(layerT2, time2, BBxLL, BBxUR, BByLL, BByUR, z, resolution, resolution);
|
double[][] slice2 = intersector.extractXYGrid(layerT2, time2, BBxLL, BBxUR, BByLL, BByUR, z, resolution, resolution);
|
||||||
|
polygonsFeatures = null;
|
||||||
|
if (intersector.currentconnector instanceof WFS)
|
||||||
|
polygonsFeatures = ((WFS) intersector.currentconnector).getPolygonsFeatures();
|
||||||
AnalysisLogger.getLogger().debug("MapsComparator: Dumping map 2");
|
AnalysisLogger.getLogger().debug("MapsComparator: Dumping map 2");
|
||||||
status = 50;
|
status = 50;
|
||||||
RasterTable raster2 = new RasterTable(BBxLL, BBxUR, BByLL, BByUR, z, resolution, resolution, slice2, config);
|
RasterTable raster2 = new RasterTable(BBxLL, BBxUR, BByLL, BByUR, z, resolution, resolution, slice2, polygonsFeatures,config);
|
||||||
raster2.dumpGeoTable();
|
raster2.dumpGeoTable();
|
||||||
String rastertable2 = raster2.getTablename();
|
String rastertable2 = raster2.getTablename();
|
||||||
AnalysisLogger.getLogger().debug("MapsComparator: Map 2 was dumped in table: " + rastertable2);
|
AnalysisLogger.getLogger().debug("MapsComparator: Map 2 was dumped in table: " + rastertable2);
|
||||||
status = 60;
|
status = 60;
|
||||||
/*
|
String columnToCompare2 = assessComparisonColumn(intersector, raster2);
|
||||||
* String rastertable1 = "rstr909f60c1d3f1472e9de998e844990724"; String rastertable2 = "rstre52e744c99224de3a1c5354263c6c8d8"; String resolution = "0.5";
|
|
||||||
*/
|
AnalysisLogger.getLogger().debug("MapsComparator: Comparing on the following features : " + columnToCompare1+" vs "+columnToCompare2);
|
||||||
|
|
||||||
config.setNumberOfResources(1);
|
config.setNumberOfResources(1);
|
||||||
config.setParam("FirstTable", rastertable1);
|
config.setParam("FirstTable", rastertable1);
|
||||||
config.setParam("SecondTable", rastertable2);
|
config.setParam("SecondTable", rastertable2);
|
||||||
config.setParam("FirstTableCsquareColumn", RasterTable.csquareColumn);
|
config.setParam("FirstTableCsquareColumn", RasterTable.csquareColumn);
|
||||||
config.setParam("SecondTableCsquareColumn", RasterTable.csquareColumn);
|
config.setParam("SecondTableCsquareColumn", RasterTable.csquareColumn);
|
||||||
config.setParam("FirstTableProbabilityColumn", RasterTable.valuesColumn);
|
config.setParam("FirstTableProbabilityColumn", columnToCompare1);
|
||||||
config.setParam("SecondTableProbabilityColumn", RasterTable.valuesColumn);
|
config.setParam("SecondTableProbabilityColumn", columnToCompare2);
|
||||||
config.setParam("ComparisonThreshold", "" + valuesthreshold);
|
config.setParam("ComparisonThreshold", "" + valuesthreshold);
|
||||||
AnalysisLogger.getLogger().debug("MapsComparator: Analyzing discrepancy between maps: " + rastertable1 + " and " + rastertable2);
|
AnalysisLogger.getLogger().debug("MapsComparator: Analyzing discrepancy between maps: " + rastertable1 + " and " + rastertable2);
|
||||||
DiscrepancyAnalysis da = new DiscrepancyAnalysis();
|
DiscrepancyAnalysis da = new DiscrepancyAnalysis();
|
||||||
|
@ -161,10 +177,10 @@ public class MapsComparator extends DataAnalysis {
|
||||||
|
|
||||||
connection = DatabaseUtils.initDBSession(config);
|
connection = DatabaseUtils.initDBSession(config);
|
||||||
AnalysisLogger.getLogger().debug("MapsComparator: Deleting table " + rastertable1);
|
AnalysisLogger.getLogger().debug("MapsComparator: Deleting table " + rastertable1);
|
||||||
DatabaseFactory.executeSQLUpdate(DatabaseUtils.dropTableStatement(rastertable1), connection);
|
// DatabaseFactory.executeSQLUpdate(DatabaseUtils.dropTableStatement(rastertable1), connection);
|
||||||
status = 90;
|
status = 90;
|
||||||
AnalysisLogger.getLogger().debug("MapsComparator: Deleting table " + rastertable2);
|
AnalysisLogger.getLogger().debug("MapsComparator: Deleting table " + rastertable2);
|
||||||
DatabaseFactory.executeSQLUpdate(DatabaseUtils.dropTableStatement(rastertable2), connection);
|
// DatabaseFactory.executeSQLUpdate(DatabaseUtils.dropTableStatement(rastertable2), connection);
|
||||||
AnalysisLogger.getLogger().debug("MapsComparator: Elapsed: Whole operation completed in " + ((double) (System.currentTimeMillis() - t0) / 1000d) + "s");
|
AnalysisLogger.getLogger().debug("MapsComparator: Elapsed: Whole operation completed in " + ((double) (System.currentTimeMillis() - t0) / 1000d) + "s");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -177,6 +193,26 @@ public class MapsComparator extends DataAnalysis {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String assessComparisonColumn(XYExtractor intersector, RasterTable raster) throws Exception{
|
||||||
|
|
||||||
|
String columnToCompare = RasterTable.valuesColumn;
|
||||||
|
try{
|
||||||
|
if (intersector.currentconnector instanceof WFS){
|
||||||
|
String[] columns = RasterTable.propertiesMapToColumnString(raster.valuesPropertiesMap.values().iterator().next(),false).split(",");
|
||||||
|
//take the last value as comparison column!
|
||||||
|
columnToCompare = columns[columns.length-1];
|
||||||
|
AnalysisLogger.getLogger().debug("Mapscomparator: Preparing column "+columnToCompare);
|
||||||
|
org.gcube.dataanalysis.ecoengine.utils.DatabaseFactory.executeUpdateNoTransaction("ALTER TABLE "+raster.getTablename()+" ALTER COLUMN "+columnToCompare+" TYPE real USING "+columnToCompare+"::real",
|
||||||
|
config.getDatabaseDriver(),config.getDatabaseUserName(),config.getDatabasePassword(),config.getDatabaseURL(), true);
|
||||||
|
}
|
||||||
|
}catch(Exception e){
|
||||||
|
throw new Exception ("Cannot compare the maps: the column "+columnToCompare+" is not real valued");
|
||||||
|
}
|
||||||
|
finally{
|
||||||
|
}
|
||||||
|
return columnToCompare;
|
||||||
|
}
|
||||||
|
|
||||||
public double getBestComparisonResolution(MatrixExtractor intersector, String layerID1, String layerID2) throws Exception{
|
public double getBestComparisonResolution(MatrixExtractor intersector, String layerID1, String layerID2) throws Exception{
|
||||||
|
|
||||||
GeoNetworkInspector fm = intersector.getFeaturer();
|
GeoNetworkInspector fm = intersector.getFeaturer();
|
||||||
|
|
|
@ -0,0 +1,263 @@
|
||||||
|
package org.gcube.dataanalysis.geo.batch;
|
||||||
|
|
||||||
|
import org.gcube.dataanalysis.geo.meta.GenericLayerMetadata;
|
||||||
|
import org.opengis.metadata.identification.TopicCategory;
|
||||||
|
|
||||||
|
public class GeothermalDataMetadataInsertDev {
|
||||||
|
|
||||||
|
static String geonetworkurl = "http://geonetwork.geothermaldata.d4science.org/geonetwork";
|
||||||
|
static String geoserverurl = "http://geoserver-dev.d4science-ii.research-infrastructures.eu/geoserver";
|
||||||
|
/*
|
||||||
|
static String geonetworkurl = "http://geonetwork.d4science.org/geonetwork/";
|
||||||
|
static String geoserverurl = "http://geoserver.d4science-ii.research-infrastructures.eu/geoserver";
|
||||||
|
*/
|
||||||
|
//static String geoserverurl = "http://geoserver-dev.d4science-ii.research-infrastructures.eu/geoserver";
|
||||||
|
|
||||||
|
static String user = "admin";
|
||||||
|
static String password = "d4science2014";
|
||||||
|
// static String workspace= "timeseriesgisdb";
|
||||||
|
//Temperature Isoline at 3 km depth
|
||||||
|
//Surface Heat Flow Map of Italy
|
||||||
|
//Temperature Isoline at 2 km depth
|
||||||
|
// Temperature Isoline at 1 km depth
|
||||||
|
//Temperature map at 1 km depth
|
||||||
|
//Surface Heat Flow Contour Map of Italy
|
||||||
|
//Temperature map at 2 km depth
|
||||||
|
//Temperature map at 3 km depth
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception{
|
||||||
|
TemperatureIsolineat3kmdepth();
|
||||||
|
SurfaceHeatFlowMapofItaly();
|
||||||
|
TemperatureIsolineat2kmdepth();
|
||||||
|
TemperatureIsolineat1kmdepth();
|
||||||
|
Temperaturemapat1kmdepth();
|
||||||
|
SurfaceHeatFlowContourMapofItaly();
|
||||||
|
Temperaturemapat2kmdepth();
|
||||||
|
Temperaturemapat3kmdepth();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void TemperatureIsolineat3kmdepth() throws Exception{
|
||||||
|
GenericLayerMetadata metadataInserter = new GenericLayerMetadata();
|
||||||
|
metadataInserter.setGeonetworkUrl(geonetworkurl);
|
||||||
|
metadataInserter.setGeonetworkUser(user);
|
||||||
|
metadataInserter.setGeonetworkPwd(password);
|
||||||
|
metadataInserter.setResolution(0);
|
||||||
|
metadataInserter.setXLeftLow(6.62397);
|
||||||
|
metadataInserter.setYLeftLow(36.64916);
|
||||||
|
metadataInserter.setXRightUpper(18.51444);
|
||||||
|
metadataInserter.setYRightUpper(47.09458);
|
||||||
|
|
||||||
|
metadataInserter.setTitle("Temperature Isoline at 3 km depth");
|
||||||
|
metadataInserter.setAbstractField("Temperature map at 3km depth (below ground level) of Italy");
|
||||||
|
metadataInserter.setCustomTopics("geothermal energy","map","Italy","Energy resources","EGIP","D4Science");
|
||||||
|
metadataInserter.setCategoryTypes("_"+TopicCategory.CLIMATOLOGY_METEOROLOGY_ATMOSPHERE.name()+"_"+"_"+TopicCategory.ENVIRONMENT.name()+"_");
|
||||||
|
metadataInserter.setResolution(0);
|
||||||
|
|
||||||
|
metadataInserter.setLayerName("IGG:iso_3000");
|
||||||
|
|
||||||
|
String [] urls = {
|
||||||
|
"http://repoigg.services.iit.cnr.it/geoserver/IGG/wms?service=WMS&version=1.3.0&request=GetMap&layers=IGG:iso_3000&styles=&bbox=7.59535694122314,36.5945739746094,17.2513008117676,46.1617622375488&width=512&height=507&crs=EPSG:4326&format=application/openlayers",
|
||||||
|
"http://repoigg.services.iit.cnr.it/geoserver/IGG/ows?service=WFS&version=1.1.0&request=GetFeature&typeName=IGG:iso_3000&srsName=urn:x-ogc:def:crs:EPSG:4326"
|
||||||
|
};
|
||||||
|
String [] protocols = {"WMS","WFS"};
|
||||||
|
|
||||||
|
metadataInserter.customMetaDataInsert(urls,protocols);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void SurfaceHeatFlowMapofItaly() throws Exception{
|
||||||
|
GenericLayerMetadata metadataInserter = new GenericLayerMetadata();
|
||||||
|
metadataInserter.setGeonetworkUrl(geonetworkurl);
|
||||||
|
metadataInserter.setGeonetworkUser(user);
|
||||||
|
metadataInserter.setGeonetworkPwd(password);
|
||||||
|
metadataInserter.setResolution(0);
|
||||||
|
metadataInserter.setXLeftLow(6.62397);
|
||||||
|
metadataInserter.setYLeftLow(36.64916);
|
||||||
|
metadataInserter.setXRightUpper(18.51444);
|
||||||
|
metadataInserter.setYRightUpper(47.09458);
|
||||||
|
|
||||||
|
metadataInserter.setTitle("Surface Heat Flow Map of Italy");
|
||||||
|
metadataInserter.setAbstractField("Surface Heat Flow Contour Map of Italy");
|
||||||
|
metadataInserter.setCustomTopics("geothermal energy","map","Italy","Energy resources","EGIP","D4Science");
|
||||||
|
metadataInserter.setCategoryTypes("_"+TopicCategory.CLIMATOLOGY_METEOROLOGY_ATMOSPHERE.name()+"_"+"_"+TopicCategory.ENVIRONMENT.name()+"_");
|
||||||
|
metadataInserter.setResolution(0);
|
||||||
|
|
||||||
|
metadataInserter.setLayerName("IGG:hf_1");
|
||||||
|
|
||||||
|
String [] urls = {
|
||||||
|
"http://repoigg.services.iit.cnr.it/geoserver/IGG/wms?service=WMS&version=1.3.0&request=GetMap&layers=IGG:hf_1&styles=&bbox=6.66010808944702,36.571231842041,18.6017723083496,47.099250793457&width=512&height=451&crs=EPSG:4326&format=application/openlayers",
|
||||||
|
"http://repoigg.services.iit.cnr.it/geoserver/IGG/ows?service=WFS&version=1.1.0&request=GetFeature&typeName=IGG:hf_1&srsName=urn:x-ogc:def:crs:EPSG:4326"
|
||||||
|
};
|
||||||
|
String [] protocols = {"WMS","WFS"};
|
||||||
|
|
||||||
|
metadataInserter.customMetaDataInsert(urls,protocols);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static void TemperatureIsolineat2kmdepth() throws Exception{
|
||||||
|
GenericLayerMetadata metadataInserter = new GenericLayerMetadata();
|
||||||
|
metadataInserter.setGeonetworkUrl(geonetworkurl);
|
||||||
|
metadataInserter.setGeonetworkUser(user);
|
||||||
|
metadataInserter.setGeonetworkPwd(password);
|
||||||
|
metadataInserter.setResolution(0);
|
||||||
|
metadataInserter.setXLeftLow(6.62397);
|
||||||
|
metadataInserter.setYLeftLow(36.64916);
|
||||||
|
metadataInserter.setXRightUpper(18.51444);
|
||||||
|
metadataInserter.setYRightUpper(47.09458);
|
||||||
|
|
||||||
|
metadataInserter.setTitle("Temperature Isoline at 2 km depth");
|
||||||
|
metadataInserter.setAbstractField("Temperature Isoline at 2 km depth (below ground level) of Italy");
|
||||||
|
metadataInserter.setCustomTopics("geothermal energy","map","Italy","Energy resources","EGIP","D4Science");
|
||||||
|
metadataInserter.setCategoryTypes("_"+TopicCategory.CLIMATOLOGY_METEOROLOGY_ATMOSPHERE.name()+"_"+"_"+TopicCategory.ENVIRONMENT.name()+"_");
|
||||||
|
metadataInserter.setResolution(0);
|
||||||
|
|
||||||
|
metadataInserter.setLayerName("IGG:iso_2000");
|
||||||
|
|
||||||
|
String [] urls = {
|
||||||
|
"http://repoigg.services.iit.cnr.it/geoserver/IGG/wms?service=WMS&version=1.1.0&request=GetMap&layers=IGG:iso_2000&styles=&bbox=7.53796720504761,36.6590042114258,17.1645240783691,46.0757904052734&width=512&height=500&crs=EPSG:4326&format=application/openlayers",
|
||||||
|
"http://repoigg.services.iit.cnr.it/geoserver/IGG/ows?service=WFS&version=1.1.0&request=GetFeature&typeName=IGG:iso_2000&srsName=urn:x-ogc:def:crs:EPSG:4326"
|
||||||
|
};
|
||||||
|
String [] protocols = {"WMS","WFS"};
|
||||||
|
|
||||||
|
metadataInserter.customMetaDataInsert(urls,protocols);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void TemperatureIsolineat1kmdepth() throws Exception{
|
||||||
|
GenericLayerMetadata metadataInserter = new GenericLayerMetadata();
|
||||||
|
metadataInserter.setGeonetworkUrl(geonetworkurl);
|
||||||
|
metadataInserter.setGeonetworkUser(user);
|
||||||
|
metadataInserter.setGeonetworkPwd(password);
|
||||||
|
metadataInserter.setResolution(0);
|
||||||
|
metadataInserter.setXLeftLow(6.62397);
|
||||||
|
metadataInserter.setYLeftLow(36.64916);
|
||||||
|
metadataInserter.setXRightUpper(18.51444);
|
||||||
|
metadataInserter.setYRightUpper(47.09458);
|
||||||
|
|
||||||
|
metadataInserter.setTitle("Temperature Isoline at 1 km depth");
|
||||||
|
metadataInserter.setAbstractField("Temperature Isoline at 1 km depth (below ground level) of Italy");
|
||||||
|
metadataInserter.setCustomTopics("geothermal energy","map","Italy","Energy resources","EGIP","D4Science");
|
||||||
|
metadataInserter.setCategoryTypes("_"+TopicCategory.CLIMATOLOGY_METEOROLOGY_ATMOSPHERE.name()+"_"+"_"+TopicCategory.ENVIRONMENT.name()+"_");
|
||||||
|
metadataInserter.setResolution(0);
|
||||||
|
|
||||||
|
metadataInserter.setLayerName("IGG:iso_1000");
|
||||||
|
|
||||||
|
String [] urls = {
|
||||||
|
"http://repoigg.services.iit.cnr.it/geoserver/IGG/wms?service=WMS&version=1.3.0&request=GetMap&layers=IGG:iso_1000&styles=&bbox=7.40797662734985,36.7031669616699,17.1524467468262,46.1305541992188&width=512&height=495&crs=EPSG:4326&format=application/openlayers",
|
||||||
|
"http://repoigg.services.iit.cnr.it/geoserver/IGG/ows?service=WFS&version=1.1.0&request=GetFeature&typeName=IGG:iso_1000&srsName=urn:x-ogc:def:crs:EPSG:4326"
|
||||||
|
};
|
||||||
|
String [] protocols = {"WMS","WFS"};
|
||||||
|
|
||||||
|
metadataInserter.customMetaDataInsert(urls,protocols);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void Temperaturemapat1kmdepth() throws Exception{
|
||||||
|
GenericLayerMetadata metadataInserter = new GenericLayerMetadata();
|
||||||
|
metadataInserter.setGeonetworkUrl(geonetworkurl);
|
||||||
|
metadataInserter.setGeonetworkUser(user);
|
||||||
|
metadataInserter.setGeonetworkPwd(password);
|
||||||
|
metadataInserter.setResolution(0);
|
||||||
|
metadataInserter.setXLeftLow(6.62397);
|
||||||
|
metadataInserter.setYLeftLow(36.64916);
|
||||||
|
metadataInserter.setXRightUpper(18.51444);
|
||||||
|
metadataInserter.setYRightUpper(47.09458);
|
||||||
|
|
||||||
|
metadataInserter.setTitle("Temperature map at 1 km depth");
|
||||||
|
metadataInserter.setAbstractField("Temperature map at 1km depth (below ground level) of Italy");
|
||||||
|
metadataInserter.setCustomTopics("geothermal energy","map","Italy","Energy resources","EGIP","D4Science");
|
||||||
|
metadataInserter.setCategoryTypes("_"+TopicCategory.CLIMATOLOGY_METEOROLOGY_ATMOSPHERE.name()+"_"+"_"+TopicCategory.ENVIRONMENT.name()+"_");
|
||||||
|
metadataInserter.setResolution(0);
|
||||||
|
|
||||||
|
metadataInserter.setLayerName("IGG:area_temp_1000");
|
||||||
|
|
||||||
|
String [] urls = {
|
||||||
|
"http://repoigg.services.iit.cnr.it/geoserver/IGG/wms?service=WMS&version=1.3.0&request=GetMap&layers=IGG:area_temp_1000&styles=&bbox=6.62688943789748,36.6438921370804,18.5206117399977,47.0919540445501&width=512&height=449&crs=EPSG:4326&format=application/openlayers",
|
||||||
|
"http://repoigg.services.iit.cnr.it/geoserver/IGG/ows?service=WFS&version=1.1.0&request=GetFeature&typeName=IGG:area_temp_1000&srsName=urn:x-ogc:def:crs:EPSG:4326"
|
||||||
|
};
|
||||||
|
String [] protocols = {"WMS","WFS"};
|
||||||
|
|
||||||
|
metadataInserter.customMetaDataInsert(urls,protocols);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void SurfaceHeatFlowContourMapofItaly() throws Exception{
|
||||||
|
GenericLayerMetadata metadataInserter = new GenericLayerMetadata();
|
||||||
|
metadataInserter.setGeonetworkUrl(geonetworkurl);
|
||||||
|
metadataInserter.setGeonetworkUser(user);
|
||||||
|
metadataInserter.setGeonetworkPwd(password);
|
||||||
|
metadataInserter.setResolution(0);
|
||||||
|
metadataInserter.setXLeftLow(6.62397);
|
||||||
|
metadataInserter.setYLeftLow(36.64916);
|
||||||
|
metadataInserter.setXRightUpper(18.51444);
|
||||||
|
metadataInserter.setYRightUpper(47.09458);
|
||||||
|
|
||||||
|
metadataInserter.setTitle("Surface Heat Flow Contour Map of Italy");
|
||||||
|
metadataInserter.setAbstractField("Surface Heat Flow Contour Map of Italy");
|
||||||
|
metadataInserter.setCustomTopics("geothermal energy","map","Italy","Energy resources","EGIP","D4Science");
|
||||||
|
metadataInserter.setCategoryTypes("_"+TopicCategory.CLIMATOLOGY_METEOROLOGY_ATMOSPHERE.name()+"_"+"_"+TopicCategory.ENVIRONMENT.name()+"_");
|
||||||
|
metadataInserter.setResolution(0);
|
||||||
|
|
||||||
|
metadataInserter.setLayerName("IGG:heat_flow_1");
|
||||||
|
|
||||||
|
String [] urls = {
|
||||||
|
"http://repoigg.services.iit.cnr.it/geoserver/IGG/wms?service=WMS&version=1.3.0&request=GetMap&layers=IGG:heat_flow_1&styles=&bbox=6.699791431427,36.5742835998535,18.6017723083496,47.0844573974609&width=512&height=452&crs=EPSG:4326&format=application/openlayers",
|
||||||
|
"http://repoigg.services.iit.cnr.it/geoserver/IGG/ows?service=WFS&version=1.1.0&request=GetFeature&typeName=IGG:heat_flow_1&srsName=urn:x-ogc:def:crs:EPSG:4326"
|
||||||
|
};
|
||||||
|
String [] protocols = {"WMS","WFS"};
|
||||||
|
|
||||||
|
metadataInserter.customMetaDataInsert(urls,protocols);
|
||||||
|
}
|
||||||
|
private static void Temperaturemapat2kmdepth() throws Exception{
|
||||||
|
GenericLayerMetadata metadataInserter = new GenericLayerMetadata();
|
||||||
|
metadataInserter.setGeonetworkUrl(geonetworkurl);
|
||||||
|
metadataInserter.setGeonetworkUser(user);
|
||||||
|
metadataInserter.setGeonetworkPwd(password);
|
||||||
|
metadataInserter.setResolution(0);
|
||||||
|
metadataInserter.setXLeftLow(6.62397);
|
||||||
|
metadataInserter.setYLeftLow(36.64916);
|
||||||
|
metadataInserter.setXRightUpper(18.51444);
|
||||||
|
metadataInserter.setYRightUpper(47.09458);
|
||||||
|
|
||||||
|
metadataInserter.setTitle("Temperature map at 2 km depth");
|
||||||
|
metadataInserter.setAbstractField("Temperature map at 2km depth (below ground level) of Italy");
|
||||||
|
metadataInserter.setCustomTopics("geothermal energy","map","Italy","Energy resources","EGIP","D4Science");
|
||||||
|
metadataInserter.setCategoryTypes("_"+TopicCategory.CLIMATOLOGY_METEOROLOGY_ATMOSPHERE.name()+"_"+"_"+TopicCategory.ENVIRONMENT.name()+"_");
|
||||||
|
metadataInserter.setResolution(0);
|
||||||
|
|
||||||
|
metadataInserter.setLayerName("IGG:area_temp_2000");
|
||||||
|
|
||||||
|
String [] urls = {
|
||||||
|
"http://repoigg.services.iit.cnr.it/geoserver/IGG/wms?service=WMS&version=1.3.0&request=GetMap&layers=IGG:area_temp_2000&styles=&bbox=6.6268892288208,36.6438903808594,18.5206127166748,47.0919570922852&width=512&height=449&crs=EPSG:4326&format=application/openlayers",
|
||||||
|
"http://repoigg.services.iit.cnr.it/geoserver/IGG/ows?service=WFS&version=1.1.0&request=GetFeature&typeName=IGG:area_temp_2000&srsName=urn:x-ogc:def:crs:EPSG:4326"
|
||||||
|
};
|
||||||
|
String [] protocols = {"WMS","WFS"};
|
||||||
|
|
||||||
|
metadataInserter.customMetaDataInsert(urls,protocols);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void Temperaturemapat3kmdepth() throws Exception{
|
||||||
|
GenericLayerMetadata metadataInserter = new GenericLayerMetadata();
|
||||||
|
metadataInserter.setGeonetworkUrl(geonetworkurl);
|
||||||
|
metadataInserter.setGeonetworkUser(user);
|
||||||
|
metadataInserter.setGeonetworkPwd(password);
|
||||||
|
metadataInserter.setResolution(0);
|
||||||
|
metadataInserter.setXLeftLow(6.62397);
|
||||||
|
metadataInserter.setYLeftLow(36.64916);
|
||||||
|
metadataInserter.setXRightUpper(18.51444);
|
||||||
|
metadataInserter.setYRightUpper(47.09458);
|
||||||
|
|
||||||
|
metadataInserter.setTitle("Temperature map at 3 km depth");
|
||||||
|
metadataInserter.setAbstractField("Temperature map at 3km depth (below ground level) of Italy");
|
||||||
|
metadataInserter.setCustomTopics("geothermal energy","map","Italy","Energy resources","EGIP","D4Science");
|
||||||
|
metadataInserter.setCategoryTypes("_"+TopicCategory.CLIMATOLOGY_METEOROLOGY_ATMOSPHERE.name()+"_"+"_"+TopicCategory.ENVIRONMENT.name()+"_");
|
||||||
|
metadataInserter.setResolution(0);
|
||||||
|
|
||||||
|
metadataInserter.setLayerName("IGG:area_temp_3000");
|
||||||
|
|
||||||
|
String [] urls = {
|
||||||
|
"http://repoigg.services.iit.cnr.it/geoserver/IGG/wms?service=WMS&version=1.3.0&request=GetMap&layers=IGG:area_temp_3000&styles=&bbox=6.6268892288208,36.5945739746094,18.5206127166748,47.0919570922852&width=512&height=451&crs=EPSG:4326&format=application/openlayers",
|
||||||
|
"http://repoigg.services.iit.cnr.it/geoserver/IGG/ows?service=WFS&version=1.1.0&request=GetFeature&typeName=IGG:area_temp_3000&srsName=urn:x-ogc:def:crs:EPSG:4326"
|
||||||
|
};
|
||||||
|
String [] protocols = {"WMS","WFS"};
|
||||||
|
|
||||||
|
metadataInserter.customMetaDataInsert(urls,protocols);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -24,7 +24,7 @@ import org.hibernate.SessionFactory;
|
||||||
public class RasterTable {
|
public class RasterTable {
|
||||||
|
|
||||||
private double valuesMatrix[][];
|
private double valuesMatrix[][];
|
||||||
private HashMap<Double, Map<String, String>> valuesPropertiesMap;
|
public HashMap<Double, Map<String, String>> valuesPropertiesMap;
|
||||||
double x1;
|
double x1;
|
||||||
double x2;
|
double x2;
|
||||||
double y1;
|
double y1;
|
||||||
|
@ -39,10 +39,10 @@ public class RasterTable {
|
||||||
private String tablename = "rstr" + ("" + UUID.randomUUID()).replace("-", "");
|
private String tablename = "rstr" + ("" + UUID.randomUUID()).replace("-", "");
|
||||||
// static String createTableStatement = "CREATE TABLE %1$s (id serial, csquarecode character varying, x real, y real, z real, t real, fvalue real)";
|
// static String createTableStatement = "CREATE TABLE %1$s (id serial, csquarecode character varying, x real, y real, z real, t real, fvalue real)";
|
||||||
static String createTableStatementStandard = "CREATE TABLE %1$s (id serial, csquarecode character varying, x real, y real, z real, t real, fvalue character varying)";
|
static String createTableStatementStandard = "CREATE TABLE %1$s (id serial, csquarecode character varying, x real, y real, z real, t real, fvalue character varying)";
|
||||||
static String createTableStatementWithFields = "CREATE TABLE %1$s (id serial, approx_x real, approx_y real, z real, t real, %2$s)";
|
static String createTableStatementWithFields = "CREATE TABLE %1$s (id serial, csquarecode character varying, approx_x real, approx_y real, z real, t real, %2$s)";
|
||||||
|
|
||||||
static String columnsnamesStandard = "csquarecode, x , y , z , t, fvalue";
|
static String columnsnamesStandard = "csquarecode, x , y , z , t, fvalue";
|
||||||
static String columnsnamesWithFields = "approx_x , approx_y , z , t , %1$s";
|
static String columnsnamesWithFields = "csquarecode, approx_x , approx_y , z , t , %1$s";
|
||||||
|
|
||||||
public static String csquareColumn = "csquarecode";
|
public static String csquareColumn = "csquarecode";
|
||||||
public static String valuesColumn = "fvalue";
|
public static String valuesColumn = "fvalue";
|
||||||
|
@ -168,7 +168,7 @@ public class RasterTable {
|
||||||
if (valuesPropertiesMap == null)
|
if (valuesPropertiesMap == null)
|
||||||
sb.append("('" + csquare + "'," + x + "," + y + "," + zVal + "," + tVal + ",'" + valueForTable + "')");
|
sb.append("('" + csquare + "'," + x + "," + y + "," + zVal + "," + tVal + ",'" + valueForTable + "')");
|
||||||
else
|
else
|
||||||
sb.append("(" + x + "," + y + "," + zVal + "," + tVal + "," + valueForTable + ")");
|
sb.append("('" + csquare + "',"+ x + "," + y + "," + zVal + "," + tVal + "," + valueForTable + ")");
|
||||||
}
|
}
|
||||||
if (rowcounter % 5000 == 0) {
|
if (rowcounter % 5000 == 0) {
|
||||||
// AnalysisLogger.getLogger().debug("Partial Inserting Buffer of " + sb.length() + " Values");
|
// AnalysisLogger.getLogger().debug("Partial Inserting Buffer of " + sb.length() + " Values");
|
||||||
|
@ -224,7 +224,7 @@ public class RasterTable {
|
||||||
int m = valuesMap.size();
|
int m = valuesMap.size();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (String keys : valuesMap.keySet()) {
|
for (String keys : valuesMap.keySet()) {
|
||||||
sb.append(keys);
|
sb.append("f_"+keys);
|
||||||
if (withtype)
|
if (withtype)
|
||||||
sb.append(" character varying");
|
sb.append(" character varying");
|
||||||
if (i < m - 1)
|
if (i < m - 1)
|
||||||
|
|
|
@ -81,7 +81,7 @@ public class GenericLayerMetadata {
|
||||||
private String contactInfo = "support@d4science.org";
|
private String contactInfo = "support@d4science.org";
|
||||||
private String abstractField = "";
|
private String abstractField = "";
|
||||||
private String purpose = "Maps publication";
|
private String purpose = "Maps publication";
|
||||||
private String author = "i-Marine";
|
private String author = "D4Science";
|
||||||
private double res = 0.5d;
|
private double res = 0.5d;
|
||||||
private double xLL = -180;
|
private double xLL = -180;
|
||||||
private double xRU = 180;
|
private double xRU = 180;
|
||||||
|
@ -296,7 +296,7 @@ public class GenericLayerMetadata {
|
||||||
// layer keywords
|
// layer keywords
|
||||||
HashMap<KeywordType, HashSet<String>> descriptiveKeyWords = new HashMap<KeywordType, HashSet<String>>();
|
HashMap<KeywordType, HashSet<String>> descriptiveKeyWords = new HashMap<KeywordType, HashSet<String>>();
|
||||||
HashSet<String> keySet = new HashSet<String>();
|
HashSet<String> keySet = new HashSet<String>();
|
||||||
keySet.add("i-Marine");
|
keySet.add("D4Science");
|
||||||
if (customTopics!=null)
|
if (customTopics!=null)
|
||||||
keySet.addAll(customTopics);
|
keySet.addAll(customTopics);
|
||||||
|
|
||||||
|
|
|
@ -29,23 +29,27 @@ public class TestMapsComparison {
|
||||||
// String layertitle2 = "FAO aquatic species distribution map of Teuthowenia megalops";
|
// String layertitle2 = "FAO aquatic species distribution map of Teuthowenia megalops";
|
||||||
//{MEAN=1.0, VARIANCE=0.0, NUMBER_OF_ERRORS=38596, NUMBER_OF_COMPARISONS=260281, ACCURACY=85.17, MAXIMUM_ERROR=1.0, MAXIMUM_ERROR_POINT=3207:219:1, TREND=CONTRACTION, Resolution=0.5}
|
//{MEAN=1.0, VARIANCE=0.0, NUMBER_OF_ERRORS=38596, NUMBER_OF_COMPARISONS=260281, ACCURACY=85.17, MAXIMUM_ERROR=1.0, MAXIMUM_ERROR_POINT=3207:219:1, TREND=CONTRACTION, Resolution=0.5}
|
||||||
|
|
||||||
String layertitle = "Sarda orientalis";
|
//String layertitle = "Sarda orientalis";
|
||||||
String layertitle2 = "FAO aquatic species distribution map of Sarda chiliensis";
|
//String layertitle2 = "FAO aquatic species distribution map of Sarda chiliensis";
|
||||||
|
|
||||||
|
String layertitle2 = "4e5c1bbf-f5ce-4b66-a67c-14d7d9920aa0";
|
||||||
|
String layertitle = "38b2eb74-1c07-4569-8a81-36ac2f973146";
|
||||||
|
|
||||||
AnalysisLogger.setLogger(cfg+AlgorithmConfiguration.defaultLoggerFile);
|
AnalysisLogger.setLogger(cfg+AlgorithmConfiguration.defaultLoggerFile);
|
||||||
AlgorithmConfiguration config = new AlgorithmConfiguration();
|
AlgorithmConfiguration config = new AlgorithmConfiguration();
|
||||||
config.setConfigPath(cfg);
|
config.setConfigPath(cfg);
|
||||||
|
config.setGcubeScope("/gcube/devsec/devVRE");
|
||||||
config.setPersistencePath("./");
|
config.setPersistencePath("./");
|
||||||
|
|
||||||
config.setParam("DatabaseUserName","gcube");
|
config.setParam("DatabaseUserName","gcube");
|
||||||
config.setParam("DatabasePassword","d4science2");
|
config.setParam("DatabasePassword","d4science2");
|
||||||
config.setParam("DatabaseURL","jdbc:postgresql://localhost/testdb");
|
config.setParam("DatabaseURL","jdbc:postgresql://localhost/testdb");
|
||||||
config.setParam("DatabaseDriver","org.postgresql.Driver");
|
config.setParam("DatabaseDriver","org.postgresql.Driver");
|
||||||
config.setParam("Layer_1",layertitle);
|
config.setParam("Layer_1",layertitle);
|
||||||
config.setParam("Layer_2",layertitle2);
|
config.setParam("Layer_2",layertitle2);
|
||||||
config.setParam("ValuesComparisonThreshold","0.01");
|
config.setParam("ValuesComparisonThreshold","0.1");
|
||||||
config.setParam("Z","0");
|
config.setParam("Z","0");
|
||||||
config.setGcubeScope(null);
|
|
||||||
|
|
||||||
MapsComparator mc = new MapsComparator();
|
MapsComparator mc = new MapsComparator();
|
||||||
mc.setConfiguration(config);
|
mc.setConfiguration(config);
|
||||||
|
|
Loading…
Reference in New Issue