Gianpaolo Coro 2014-03-03 09:46:51 +00:00
parent 06b2912a76
commit fcd3924a6c
1 changed files with 29 additions and 0 deletions

View File

@ -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<String,String> 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";
}