public WMSCoverageReader(WebMapServer wms, Layer layer, String style) { this.wms = wms; // init the reader addLayer(layer, style); // best guess at the format with a preference for PNG (since it's normally transparent) List<String> formats = wms.getCapabilities().getRequest().getGetMap().getFormats(); this.format = formats.iterator().next(); for (String format : formats) { if ("image/png".equals(format) || "image/png24".equals(format) || "png".equals(format) || "png24".equals(format) || "image/png; mode=24bit".equals(format)) { this.format = format; break; } } }
public GeneralParameterDescriptor createFormatReadParam() { Map properties = fillProperties("FORMAT", "Value contains the desired format"); GeneralParameterDescriptor param = new DefaultParameterDescriptor(properties, String.class, capabilities.getRequest().getGetMap().getFormats().toArray(new String[capabilities.getRequest().getGetMap().getFormats().size()]), null, null, null, null, true); return param; }
private String getCascadingFormat(WebMapServer server) { // best guess at the format with a preference for PNG (since it's normally transparent) List<String> formats = server.getCapabilities().getRequest().getGetMap().getFormats(); String requestFormat = null; for (String format : formats) { if (format.toLowerCase().contains("image/png") || "png".equalsIgnoreCase(format)) { requestFormat = format; break; } } // if we did not find any format looking like PNG choose any that ImageIO would likely read if (requestFormat == null) { for (String format : formats) { String loFormat = format.toLowerCase(); if (loFormat.contains("jpeg") || loFormat.contains("gif") || loFormat.contains("tif")) { requestFormat = format; break; } } } if (requestFormat == null) { throw new WPSException( "Could not find a suitable WMS cascading format among server supported formats: " + formats); } return requestFormat; }
/** * Creates a GetMapRequest that can be configured and then passed to issueRequest(). * * @return a configureable GetMapRequest object */ public GetMapRequest createGetMapRequest() { URL onlineResource = findURL(getCapabilities().getRequest().getGetMap()); return (GetMapRequest) getSpecification().createGetMapRequest(onlineResource); }
/** * Creates a GetMapRequest that can be configured and then passed to * issueRequest(). * * @return a configureable GetMapRequest object */ public GetMapRequest createGetMapRequest() { URL onlineResource = findURL(getCapabilities().getRequest().getGetMap()); return (GetMapRequest) getSpecification().createGetMapRequest(onlineResource); }