From fcd3924a6c7f6e56a24a68eda79a873447d23b47 Mon Sep 17 00:00:00 2001 From: Gianpaolo Coro Date: Mon, 3 Mar 2014 09:46:51 +0000 Subject: [PATCH] git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/EcologicalEngineGeoSpatialExtension@92537 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../dataanalysis/geo/meta/OGCFormatter.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/main/java/org/gcube/dataanalysis/geo/meta/OGCFormatter.java b/src/main/java/org/gcube/dataanalysis/geo/meta/OGCFormatter.java index 40f62f9..2db5cb0 100644 --- a/src/main/java/org/gcube/dataanalysis/geo/meta/OGCFormatter.java +++ b/src/main/java/org/gcube/dataanalysis/geo/meta/OGCFormatter.java @@ -1,5 +1,7 @@ package org.gcube.dataanalysis.geo.meta; +import java.util.HashMap; + public class OGCFormatter { public static String getWfsUrl(String geoServerUrl, String layerName, String bbox, int limit, String format) { return geoServerUrl + "/wfs?service=wfs&version=1.1.0&REQUEST=GetFeature" + "&TYPENAME=" + layerName + (bbox==null? "":"&BBOX=" + bbox) + (limit == 0 ? "" : "&MAXFEATURES=" + limit) + (format == null ? "" : "&OUTPUTFORMAT=" + format); @@ -13,6 +15,33 @@ public class OGCFormatter { return geoServerUrl + "/wcs?service=wcs&version=1.0.0" + "&request=GetCoverage&coverage=" + layerName + "&CRS=EPSG:4326" + "&bbox=" + bbox + "&width=676&height=330&format=geotiff"; } + public static String getWcsUrl(String baseUrl, String coverage, String crs, String responsecrs, String boundingbox, String width, String height, String depth, String format, String resx,String resy,String resz,String time, HashMap parameters ) { + String wcsURL = baseUrl; + if (!wcsURL.endsWith("?")) + wcsURL+="/wcs?"; + + wcsURL+="service=wcs&version=1.0.0"+"&request=GetCoverage&coverage=" + coverage+"&CRS="+crs+ "&bbox=" + boundingbox+"&width="+width+"&height="+height+"&format="+format; + if (responsecrs!=null && responsecrs.trim().length()>0) + wcsURL+="&RESPONSE_CRS="+responsecrs; + if (depth!=null && depth.trim().length()>0) + wcsURL+="&DEPTH="+depth; + if (resx!=null && resx.trim().length()>0) + wcsURL+="&RESX="+resx; + if (resy!=null && resy.trim().length()>0) + wcsURL+="&RESY="+resy; + if (resz!=null && resz.trim().length()>0) + wcsURL+="&RESZ="+resz; + if (time!=null && time.trim().length()>0) + wcsURL+="&TIME="+time; + + for (String key:parameters.keySet()){ + String value = parameters.get(key); + wcsURL+="&"+key+"="+value; + } + + return wcsURL; + } + public static String getWmsNetCDFUrl(String fileUrl, String layerName, String bbox) { return fileUrl.replace("dodsC", "wms") + "?service=wms&version=1.3.0" + "&request=GetMap&layers=" + layerName + "&bbox=" + bbox + "&styles=&width=676&height=330&srs=EPSG:4326&CRS=EPSG:4326&format=image/png"; }