public void encode( GridCoverage2D sourceCoverage, String outputFormat, Map<String, String> econdingParameters, OutputStream output) throws IOException { Utilities.ensureNonNull("sourceCoverage", sourceCoverage); Utilities.ensureNonNull("econdingParameters", econdingParameters); GeoTiffWriterHelper writerHelper = new GeoTiffWriterHelper(sourceCoverage); // compression handleCompression(econdingParameters, writerHelper); // tiling handleTiling(econdingParameters, sourceCoverage, writerHelper); // interleaving handleInterleaving(econdingParameters, sourceCoverage, writerHelper); if (geoserver.getService(WCSInfo.class).isLatLon()) { final ParameterValueGroup gp = writerHelper.getGeotoolsWriteParams(); gp.parameter(GeoTiffFormat.RETAIN_AXES_ORDER.getName().toString()).setValue(true); } try { writerHelper.write(output); } finally { sourceCoverage.dispose(false); } }
@Override protected WCSInfo initialize(WCSInfo service) { super.initialize(service); if (service.getExceptionFormats() == null) { ((WCSInfoImpl) service).setExceptionFormats(new ArrayList<String>()); } if (service.getVersions().isEmpty()) { service.getVersions().add(new Version("1.0.0")); service.getVersions().add(new Version("1.1.1")); } Version v201 = new Version("2.0.1"); if (!service.getVersions().contains(v201)) { service.getVersions().add(v201); } if (service.getSRS() == null) { ((WCSInfoImpl) service).setSRS(new ArrayList<String>()); } return service; } }
@Override protected void wrapInternal(Map properties, SimpleHash model, WCSInfo wcsInfo) { WorkspaceInfo workspaceInfo = wcsInfo.getWorkspace(); properties.put("workspaceName", workspaceInfo != null ? workspaceInfo.getName() : "NO_WORKSPACE"); properties.put("enabled", wcsInfo.isEnabled() ? "true" : "false"); properties.put("name", wcsInfo.getName()); properties.put("title", wcsInfo.getTitle()); properties.put("maintainer", wcsInfo.getMaintainer()); properties.put("abstract", wcsInfo.getAbstract()); properties.put("accessConstraints", wcsInfo.getAccessConstraints()); properties.put("fees", wcsInfo.getFees()); properties.put("versions", wcsInfo.getVersions()); properties.put("keywords", wcsInfo.getKeywords()); properties.put("metadataLink", wcsInfo.getMetadataLink()); properties.put("citeCompliant", wcsInfo.isCiteCompliant() ? "true" : "false"); properties.put("onlineResource", wcsInfo.getOnlineResource()); properties.put("schemaBaseURL", wcsInfo.getSchemaBaseURL()); properties.put("verbose", wcsInfo.isVerbose() ? "true" : "false"); properties.put("isSubsamplingEnabled", wcsInfo.isSubsamplingEnabled() ? "true" : "false"); properties.put("overviewPolicy", wcsInfo.getOverviewPolicy()); properties.put("maxInputMemory", String.valueOf(wcsInfo.getMaxInputMemory())); properties.put("maxOutputMemory", String.valueOf(wcsInfo.getMaxOutputMemory())); } });
/** * Handles the service identification of the capabilities document. * * @param config The OGC service to transform. * @throws SAXException For any errors. */ protected void handleServiceIdentification() { start("ows:ServiceIdentification"); element("ows:Title", wcs.getTitle()); element("ows:Abstract", wcs.getAbstract()); handleKeywords(wcs.getKeywords()); element("ows:ServiceType", "WCS"); element("ows:ServiceTypeVersion", "1.1.0"); element("ows:ServiceTypeVersion", "1.1.1"); String fees = wcs.getFees(); if ((fees == null) || "".equals(fees)) { fees = "NONE"; } element("ows:Fees", fees); String accessConstraints = wcs.getAccessConstraints(); if ((accessConstraints == null) || "".equals(accessConstraints)) { accessConstraints = "NONE"; } element("ows:AccessConstraints", accessConstraints); end("ows:ServiceIdentification"); }
if (wcs.getMetadataLink() != null) { handleMetadataLink(wcs.getMetadataLink(), "simple"); element("wcs:description", wcs.getAbstract()); element("wcs:name", wcs.getName()); element("wcs:label", wcs.getTitle()); handleKeywords(wcs.getKeywords()); handleContact(); String fees = wcs.getFees(); String accessConstraints = wcs.getAccessConstraints();
@Test public void testRequestCoverageLatLon() throws Exception { final WCSInfo wcsInfo = getWCS(); final boolean oldLatLon = wcsInfo.isLatLon(); wcsInfo.setLatLon(true); getGeoServer().save(wcsInfo); try { // http response from the request inside the string MockHttpServletResponse response = getAsServletResponse("ows?request=GetCoverage&service=WCS&version=2.0.1" + "&coverageId=wcs__2DLatLonCoverage&format=application/custom&subset=time,http://www.opengis.net/def/trs/ISO-8601/0/Gregorian UTC(\"2013-11-01T00:00:00.000Z\")&subset=BANDS(\"MyBand\")"); assertNotNull(response); GridCoverage2D lastResult = applicationContext.getBean(WCSResponseInterceptor.class) .getLastResult(); assertTrue(lastResult instanceof GranuleStack); GranuleStack stack = (GranuleStack) lastResult; // we expect a single granule which covers the entire mosaic for (GridCoverage2D c : stack.getGranules()) { System.out.println(c.getEnvelope()); assertEquals(45., c.getEnvelope2D().getHeight(), 0.001); assertEquals(30., c.getEnvelope2D().getWidth(), 0.001); } assertEquals(1, stack.getGranules().size()); } finally { wcsInfo.setLatLon(oldLatLon); getGeoServer().save(wcsInfo); } }
public DescribeCoverageTransformer describeCoverage(DescribeCoverageType request) { final String version = request.getVersion(); if ("1.1.0".equals(version) || "1.1.1".equals(version)) { WCSInfo wcs = getServiceInfo(); DescribeCoverageTransformer describeTransformer = new DescribeCoverageTransformer(wcs, catalog, responseFactory); describeTransformer.setEncoding( Charset.forName(wcs.getGeoServer().getSettings().getCharset())); return describeTransformer; } throw new WcsException("Could not understand version:" + version); }
protected void setInputLimit(int kbytes) { GeoServer gs = getGeoServer(); WCSInfo info = gs.getService(WCSInfo.class); info.setMaxInputMemory(kbytes); gs.save(info); }
protected void setOutputLimit(int kbytes) { GeoServer gs = getGeoServer(); WCSInfo info = gs.getService(WCSInfo.class); info.setMaxOutputMemory(kbytes); gs.save(info); }
@Before public void enableWCSEO() { WCSInfo wcs = getGeoServer().getService(WCSInfo.class); wcs.getMetadata().put(WCSEOMetadata.ENABLED.key, true); wcs.getMetadata().put(WCSEOMetadata.COUNT_DEFAULT.key, String.valueOf(20)); wcs.getSRS().clear(); wcs.getSRS().add("4326"); wcs.getSRS().add("3857"); getGeoServer().save(wcs); wcs = getGeoServer().getService(WCSInfo.class); assertTrue(wcs.getMetadata().get(WCSEOMetadata.ENABLED.key, Boolean.class)); }
@Test public void test() throws Exception { login(); WCSInfo wcs = getGeoServerApplication().getGeoServer().getService(WCSInfo.class); // start the page tester.startPage(new WCSAdminPage()); tester.assertRenderedPage(WCSAdminPage.class); // test that components have been filled as expected tester.assertComponent("form:keywords", KeywordsEditor.class); tester.assertModelValue("form:keywords", wcs.getKeywords()); } }
start("ows:ServiceIdentification"); element("ows:Title", wcs.getTitle()); element("ows:Abstract", wcs.getAbstract()); handleKeywords(wcs.getKeywords()); String fees = wcs.getFees(); if (isBlank(fees)) { fees = "NONE"; String accessConstraints = wcs.getAccessConstraints(); if (isBlank(accessConstraints)) { accessConstraints = "NONE";
@Test public void testRequestCoverageLatLon() throws Exception { final WCSInfo wcsInfo = getWCS(); final boolean oldLatLon = wcsInfo.isLatLon(); wcsInfo.setLatLon(true); getGeoServer().save(wcsInfo); try { // http response from the request inside the string MockHttpServletResponse response = getAsServletResponse( "ows?request=GetCoverage&service=WCS&version=2.0.1" + "&coverageId=wcs__2DLatLonCoverage&format=application/custom&subset=time,http://www.opengis.net/def/trs/ISO-8601/0/Gregorian UTC(\"2013-11-01T00:00:00.000Z\")&subset=BANDS(\"MyBand\")"); assertNotNull(response); GridCoverage2D lastResult = applicationContext.getBean(WCSResponseInterceptor.class).getLastResult(); assertTrue(lastResult instanceof GranuleStack); GranuleStack stack = (GranuleStack) lastResult; // we expect a single granule which covers the entire mosaic for (GridCoverage2D c : stack.getGranules()) { System.out.println(c.getEnvelope()); assertEquals(45., c.getEnvelope2D().getHeight(), 0.001); assertEquals(30., c.getEnvelope2D().getWidth(), 0.001); } assertEquals(1, stack.getGranules().size()); } finally { wcsInfo.setLatLon(oldLatLon); getGeoServer().save(wcsInfo); } }
|| WCS20Const.V111.equals(negotiatedVersion)) { LOGGER.warning("GetCapa2.0 Dispatching to 1.1"); // next code should be tested a bit WCSCapsTransformer capsTransformer = new WCSCapsTransformer(wcs.getGeoServer()); capsTransformer.setEncoding( Charset.forName((wcs.getGeoServer().getSettings().getCharset()))); return capsTransformer; } else if (WCS20Const.V20.equals(negotiatedVersion) || WCS20Const.V201.equals(negotiatedVersion)) { WCS20GetCapabilitiesTransformer capsTransformer = new WCS20GetCapabilitiesTransformer(wcs.getGeoServer(), responseFactory); capsTransformer.setEncoding( Charset.forName((wcs.getGeoServer().getSettings().getCharset()))); return capsTransformer; } else {
protected void setInputLimit(int kbytes) { GeoServer gs = getGeoServer(); WCSInfo info = gs.getService(WCSInfo.class); info.setMaxInputMemory(kbytes); gs.save(info); }
protected void setOutputLimit(int kbytes) { GeoServer gs = getGeoServer(); WCSInfo info = gs.getService(WCSInfo.class); info.setMaxOutputMemory(kbytes); gs.save(info); }
@Before public void cleanupLimitedSRS() { WCSInfo service = getGeoServer().getService(WCSInfo.class); service.getSRS().clear(); getGeoServer().save(service); }
/** */ public Wcs10CapsTransformer getCapabilities(GetCapabilitiesType request) { // do the version negotiation dance List<String> provided = new ArrayList<String>(); provided.add("1.0.0"); List<String> accepted = null; if (request.getVersion() != null) { accepted = new ArrayList<String>(); accepted.add(request.getVersion()); } String version = RequestUtils.getVersionPreOws(provided, accepted); if ("1.0.0".equals(version)) { Wcs10CapsTransformer capsTransformer = new Wcs10CapsTransformer(geoServer); capsTransformer.setEncoding( Charset.forName((getServiceInfo().getGeoServer().getSettings().getCharset()))); return capsTransformer; } throw new WcsException("Could not understand version:" + version); }