@Test public void testAntimeridianTaz() throws Exception { // for the moment, just make sure we don't die and return something, see Map<String, Object> raw = baseMap(); final String getLayerId = getLayerId(TASMANIA_BM); raw.put("identifier", getLayerId); raw.put("format", "image/geotiff"); raw.put("store", "false"); // complete coverage from left side of request bbox raw.put("BoundingBox", "145,-80,-175,0,urn:ogc:def:crs:OGC:1.3:CRS84"); executeGetCoverageKvp(raw); // partial coverage from left side of request bbox raw.put("BoundingBox", "147,-80,-175,0,urn:ogc:def:crs:OGC:1.3:CRS84"); executeGetCoverageKvp(raw); // partial coverage from both left and right side raw.put("BoundingBox", "147.2,-80,147,0,urn:ogc:def:crs:OGC:1.3:CRS84"); executeGetCoverageKvp(raw); // partial coverage from right side raw.put("BoundingBox", "175,-80,147,0,urn:ogc:def:crs:OGC:1.3:CRS84"); executeGetCoverageKvp(raw); // full coverage from right side raw.put("BoundingBox", "175,-80,150,0,urn:ogc:def:crs:OGC:1.3:CRS84"); executeGetCoverageKvp(raw); }
@Test public void testDeferredLoading() throws Exception { Map<String, Object> raw = baseMap(); final String getLayerId = getLayerId(SPATIO_TEMPORAL); raw.put("identifier", getLayerId); raw.put("format", "image/tiff"); raw.put("BoundingBox", "-90,-180,90,180,urn:ogc:def:crs:EPSG:6.6:4326"); raw.put("store", "false"); raw.put("GridBaseCRS", "urn:ogc:def:crs:EPSG:6.6:4326"); GridCoverage[] coverages = executeGetCoverageKvp(raw); assertEquals(1, coverages.length); assertDeferredLoading(coverages[0].getRenderedImage()); }
@Test public void testDeferredLoading() throws Exception { Map<String, Object> raw = baseMap(); final String getLayerId = getLayerId(SPATIO_TEMPORAL); raw.put("sourcecoverage", getLayerId); raw.put("format", "image/tiff"); raw.put("BBox", "-90,-180,90,180"); raw.put("crs", "EPSG:4326"); raw.put("resx", "0.001"); raw.put("resy", "0.001"); GridCoverage[] coverages = executeGetCoverageKvp(raw); assertEquals(1, coverages.length); assertDeferredLoading(coverages[0].getRenderedImage()); }
@Test public void testKvpBasic() throws Exception { Map<String, Object> raw = baseMap(); final String getLayerId = getLayerId(TASMANIA_BM); raw.put("identifier", getLayerId); raw.put("format", "image/tiff"); raw.put("BoundingBox", "-90,-180,90,180,urn:ogc:def:crs:EPSG:6.6:4326"); raw.put("store", "false"); raw.put("GridBaseCRS", "urn:ogc:def:crs:EPSG:6.6:4326"); GridCoverage[] coverages = executeGetCoverageKvp(raw); assertEquals(1, coverages.length); GridCoverage2D coverage = (GridCoverage2D) coverages[0]; assertEquals( CRS.decode("urn:ogc:def:crs:EPSG:6.6:4326"), coverage.getEnvelope().getCoordinateReferenceSystem()); }
@Test public void testAntimeridianWorld() throws Exception { // for the moment, just make sure we don't die and return something, see Map<String, Object> raw = baseMap(); final String getLayerId = getLayerId(WORLD); raw.put("identifier", getLayerId); raw.put("format", "image/geotiff"); raw.put("BoundingBox", "175,10,-175,20,urn:ogc:def:crs:OGC:1.3:CRS84"); raw.put("store", "false"); // raw.put("GridBaseCRS", "urn:ogc:def:crs:EPSG:6.6:4326"); GridCoverage[] coverages = executeGetCoverageKvp(raw); assertEquals(1, coverages.length); GridCoverage2D coverage = (GridCoverage2D) coverages[0]; assertEquals( CRS.decode("urn:ogc:def:crs:EPSG:6.6:4326"), coverage.getEnvelope().getCoordinateReferenceSystem()); }
@Test public void testWrongGridOrigin() throws Exception { Map<String, Object> raw = baseMap(); final String getLayerId = getLayerId(TASMANIA_BM); raw.put("identifier", getLayerId); raw.put("format", "image/geotiff"); raw.put("BoundingBox", "-45,146,-42,147,urn:ogc:def:crs:EPSG:6.6:4326"); raw.put("GridOrigin", "12,13,14"); try { executeGetCoverageKvp(raw); fail("We should have had a WcsException here?"); } catch (WcsException e) { assertEquals(InvalidParameterValue.name(), e.getCode()); assertEquals("GridOrigin", e.getLocator()); } }
@Test public void testWrongFormatParams() throws Exception { Map<String, Object> raw = baseMap(); final String getLayerId = getLayerId(TASMANIA_BM); raw.put("identifier", getLayerId); raw.put("format", "SuperCoolFormat"); raw.put("BoundingBox", "-45,146,-42,147,urn:ogc:def:crs:EPSG:6.6:4326"); try { executeGetCoverageKvp(raw); fail("When did we learn to encode SuperCoolFormat?"); } catch (WcsException e) { assertEquals(InvalidParameterValue.toString(), e.getCode()); assertEquals("format", e.getLocator()); } }
@Test public void testDefaultGridOrigin() throws Exception { Map<String, Object> raw = new HashMap<String, Object>(baseMap()); final String getLayerId = getLayerId(TASMANIA_BM); raw.put("identifier", getLayerId); raw.put("format", "image/geotiff"); // use a bbox larger than the source raw.put("BoundingBox", "-45,146,-42,149,urn:ogc:def:crs:EPSG:6.6:4326"); GridCoverage[] coverages = executeGetCoverageKvp(raw); AffineTransform2D tx = (AffineTransform2D) coverages[0].getGridGeometry().getGridToCRS(); // take into account the "pixel is area" convention assertEquals(0.0, tx.getTranslateX() + tx.getScaleX() / 2, 1e-9); assertEquals(0.0, tx.getTranslateY() + tx.getScaleY() / 2, 1e-9); }
@Test public void testSpatialSubsetOnePixel() throws Exception { Map<String, Object> raw = new HashMap<String, Object>(baseMap()); final String getLayerId = getLayerId(RAIN); raw.put("identifier", getLayerId); raw.put("format", "image/geotiff"); // this bbox is inside, and smaller than a single pixel raw.put("BoundingBox", "-45,146,-42,149,urn:ogc:def:crs:EPSG:6.6:4326"); GridCoverage[] coverages = executeGetCoverageKvp(raw); Envelope envelope = coverages[0].getEnvelope(); assertEquals(-45d, envelope.getMinimum(0), 1e-6); assertEquals(-42d, envelope.getMaximum(0), 1e-6); assertEquals(146d, envelope.getMinimum(1), 1e-6); assertEquals(149d, envelope.getMaximum(1), 1e-6); }
@Test public void testRotated() throws Exception { final String layerId = getLayerId(MockData.ROTATED_CAD); // do the request Map<String, Object> raw = baseMap(); raw.put("identifier", layerId); raw.put("format", "image/geotiff"); raw.put( "BoundingBox", "7.7634301664746515,45.14713380418506,7.764350661575157,45.14763319238466,EPSG:4326"); GridCoverage[] coverages = executeGetCoverageKvp(raw); // System.out.println(coverages[0]); // check the envelope Envelope envelope = coverages[0].getEnvelope(); // System.out.println(envelope); CoordinateReferenceSystem targetCRS = CRS.decode("urn:x-ogc:def:crs:EPSG:3003"); assertEquals(targetCRS, envelope.getCoordinateReferenceSystem()); // check we did not get a massive raster out GridEnvelope range = coverages[0].getGridGeometry().getGridRange(); assertEquals(482, range.getSpan(0)); assertEquals(447, range.getSpan(1)); }
raw.put("resy", Double.toString(Math.abs(expectedTx.getScaleY()))); final GridCoverage[] coverages = executeGetCoverageKvp(raw); final GridCoverage2D result=(GridCoverage2D) coverages[0]; assertTrue(coverages.length==1);
raw.put("resy", Double.toString(Math.abs(expectedTx.getScaleY()))); final GridCoverage[] coverages = executeGetCoverageKvp(raw); final GridCoverage2D result = (GridCoverage2D) coverages[0]; assertTrue(coverages.length == 1);
raw.put("BoundingBox", "-80,-180,80,180,urn:ogc:def:crs:EPSG:6.6:4326"); raw.put("GridBaseCRS", "EPSG:3857"); GridCoverage[] coverages = executeGetCoverageKvp(raw);