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); } }
if (wcs.isLatLon() && enforceLatLonAxesOrder) { coverage = enforceLatLongOrder(coverage, hints, gridCoverageRequest.getOutputCRS());
@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); } }
@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); } }
final boolean oldLatLon = wcsInfo.isLatLon(); wcsInfo.setLatLon(false); getGeoServer().save(wcsInfo);
final boolean oldLatLon = wcsInfo.isLatLon(); wcsInfo.setLatLon(true); getGeoServer().save(wcsInfo);