patch to manage MAP Server layers

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/EcologicalEngineGeoSpatialExtension@100458 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Gianpaolo Coro 2014-10-06 14:59:29 +00:00
parent b46b6bef8c
commit 9119b94634
5 changed files with 61 additions and 8 deletions

View File

@ -141,7 +141,7 @@ public class MaxEnt4NicheModellingTransducer implements Transducerer {
IOHelper.addDoubleInput(inputs, yRes, "Projection resolution on the Y axis in degrees", "1");
// layers to use in the model
PrimitiveTypesList listEnvLayers = new PrimitiveTypesList(String.class.getName(), PrimitiveTypes.STRING, Layers, "The list of environmental layers to use for enriching the points. Each entry is a layer Title or UUID or HTTP link. E.g. the title or the UUID (preferred) of a layer indexed in the e-Infrastructure on GeoNetwork - You can retrieve it from GeoExplorer. Otherwise you can supply the direct HTTP link of the layer. The format will be guessed from the link. The default is GeoTiff. Supports several standards (NETCDF, WFS, WCS, ASC, GeoTiff )", false);
PrimitiveTypesList listEnvLayers = new PrimitiveTypesList(String.class.getName(), PrimitiveTypes.STRING, Layers, "The list of environmental layers to use for enriching the points. Each entry is a layer Title or UUID or HTTP link. E.g. the title or the UUID (preferred) of a layer indexed in the e-Infrastructure on GeoNetwork - You can retrieve it from GeoExplorer. Otherwise you can supply the direct HTTP link of the layer. The format will be guessed from the link. The default is GeoTiff. Supports several standards (NETCDF, WFS, WCS, ASC, GeoTiff ). E.g. https://dl.dropboxusercontent.com/u/12809149/wind1.tif", false);
inputs.add(listEnvLayers);
DatabaseType.addDefaultDBPars(inputs);

View File

@ -44,8 +44,11 @@ public class WFS implements GISDataConnector {
for (Tuple<Double> triplet : coordinates3d) {
ArrayList<Double> elements = triplet.getElements();
//add correction in WFS projection: y axis is inverted!
CoordinateArraySequence pcoords = new CoordinateArraySequence(new Coordinate[] { new Coordinate(elements.get(0), elements.get(1)), });
//patch for MAP server
if (layerURL.contains("/wxs")){
pcoords = new CoordinateArraySequence(new Coordinate[] { new Coordinate(elements.get(1), elements.get(0)), });
}
Point po = new Point(pcoords, factory);
boolean found = false;

View File

@ -9,9 +9,18 @@ public class OGCFormatter {
geoServerUrl = geoServerUrl.substring(0,idx);
}
else
geoServerUrl = geoServerUrl + "/wfs";
//the srsName keeps lat,long output constant
return geoServerUrl+"?service=wfs&version=1.1.0&REQUEST=GetFeature" + "&srsName=urn:x-ogc:def:crs:EPSG:4326&TYPENAME=" + layerName + (bbox==null? "":"&BBOX=" + bbox) + (limit == 0 ? "" : "&MAXFEATURES=" + limit) + (format == null ? "" : "&OUTPUTFORMAT=" + format);
geoServerUrl = geoServerUrl + "/wfs";
String srsString = "srsName=urn:x-ogc:def:crs:EPSG:4326";
//patch for Map Server
if (geoServerUrl.contains("/wxs") && format.equalsIgnoreCase("json")){
format = "application/json;%20subtype=geojson";
srsString = "srsName=EPSG:4326";
}
//the srsName keeps lat,long output constant
return geoServerUrl+"?service=wfs&version=1.1.0&REQUEST=GetFeature" + "&"+srsString+"&TYPENAME=" + layerName + (bbox==null? "":"&BBOX=" + bbox) + (limit == 0 ? "" : "&MAXFEATURES=" + limit) + (format == null ? "" : "&OUTPUTFORMAT=" + format);
}
public static String getWmsUrl(String geoServerUrl, String layerName, String style, String bbox) {

View File

@ -75,6 +75,16 @@ public class TestExtractionXYMatrixFromTable {
config.setParam(TableMatrixRepresentation.filterParameter, "");
}
public static void sliceTableMapServer(AlgorithmConfiguration config) throws Exception {
config.setParam(TableMatrixRepresentation.tableNameParameter, "testextraction3");
config.setParam(TableMatrixRepresentation.xDimensionColumnParameter, "approx_x");
config.setParam(TableMatrixRepresentation.yDimensionColumnParameter, "approx_y");
config.setParam(TableMatrixRepresentation.timeDimensionColumnParameter, "time");
config.setParam(TableMatrixRepresentation.valueDimensionColumnParameter, "f_depth");
config.setParam(TableMatrixRepresentation.filterParameter, "");
}
public static void main(String[] args) throws Exception {
AnalysisLogger.setLogger("./cfg/" + AlgorithmConfiguration.defaultLoggerFile);
@ -87,7 +97,7 @@ public class TestExtractionXYMatrixFromTable {
config.setParam("DatabaseURL", "jdbc:postgresql://localhost/testdb");
config.setParam("DatabaseDriver", "org.postgresql.Driver");
config.setGcubeScope("/gcube/devsec/devVRE");
sliceMaxEnt(config);
sliceTableMapServer(config);
double resolution = 1;
FileWriter fw = new FileWriter(new File("maps.txt"));

View File

@ -19,8 +19,8 @@ public class TestXYExtractionAlgorithm {
// static AlgorithmConfiguration[] configs = { testXYExtractionGeotermia()};
// static AlgorithmConfiguration[] configs = { testXYExtractionFAO()};
// static AlgorithmConfiguration[] configs = { testXYExtractionNetCDF()};
static AlgorithmConfiguration[] configs = { testXYExtractionWFS11()};
// static AlgorithmConfiguration[] configs = { testXYExtractionWFS11()};
static AlgorithmConfiguration[] configs = { testXYExtractionWFSDirect()};
public static void main(String[] args) throws Exception {
@ -179,6 +179,37 @@ public class TestXYExtractionAlgorithm {
return config;
}
private static AlgorithmConfiguration testXYExtractionWFSDirect() {
AlgorithmConfiguration config = new AlgorithmConfiguration();
config.setAgent("XYEXTRACTOR");
config.setConfigPath("./cfg/");
config.setPersistencePath("./");
config.setParam("DatabaseUserName","gcube");
config.setParam("DatabasePassword","d4science2");
config.setParam("DatabaseURL","jdbc:postgresql://localhost/testdb");
config.setParam("DatabaseDriver","org.postgresql.Driver");
config.setGcubeScope("/d4science.research-infrastructures.eu/gCubeApps/EGIP");
config.setParam("Layer","http://repoigg.services.iit.cnr.it/geoserver/IGG/ows?service=WFS&version=1.1.0&request=GetFeature&srsName=urn:x-ogc:def:crs:EPSG:4326&TYPENAME=IGG:HeatFlowUnit");
// config.setParam("Layer","http://egip.brgm-rec.fr/wxs/?service=WFS&version=1.1.0&request=GetFeature&typeName=TemperatureUnit&srsName=EPSG:4326");
config.setParam("Z","0");
config.setParam("TimeIndex","0");
config.setParam("BBox_LowerLeftLat","0");
config.setParam("BBox_LowerLeftLong","-180");
config.setParam("BBox_UpperRightLat","90");
config.setParam("BBox_UpperRightLong","180");
config.setParam("XResolution","0.3");
config.setParam("YResolution","0.3");
config.setParam("OutputTableName","testextraction3");
config.setParam("OutputTableLabel","testextraction3");
return config;
}
private static AlgorithmConfiguration testDirectExtraction() {
AlgorithmConfiguration config = new AlgorithmConfiguration();