private OutputType parseOutputElement(Map kvp) throws Exception { final OutputType output = Wcs111Factory.eINSTANCE.createOutputType(); output.setGridCRS(Wcs111Factory.eINSTANCE.createGridCrsType()); // check and set store Boolean store = (Boolean) kvp.get("store"); if (store != null) output.setStore(store.booleanValue()); // check and set format String format = (String) kvp.get("format"); if (format == null) throw new WcsException("format parameter is mandatory", MissingParameterValue, "format"); output.setFormat(format); // set the other gridcrs properties final GridCrsType gridCRS = output.getGridCRS(); gridCRS.setGridBaseCRS((String) kvp.get("gridBaseCrs")); gridCRS.setGridType((String) kvp.get("gridType")); gridCRS.setGridCS((String) kvp.get("gridCS")); gridCRS.setGridOrigin((Double[]) kvp.get("GridOrigin")); gridCRS.setGridOffsets((Double[]) kvp.get("GridOffsets")); return output; }
final GridCrsType gridCRS = output.getGridCRS(); gridCRS.setGridBaseCRS((String) kvp.get("gridBaseCrs"));
@Test public void testBasic() throws Exception { Map<String, Object> raw = baseMap(); final String layerId = getLayerId(TASMANIA_BM); raw.put("identifier", layerId); raw.put("format", "image/tiff"); raw.put("BoundingBox", "-45,146,-42,147"); raw.put("store", "false"); raw.put("GridBaseCRS", "urn:ogc:def:crs:EPSG:6.6:4326"); GetCoverageType getCoverage = (GetCoverageType) reader.read(reader.createRequest(), parseKvp(raw), raw); assertEquals(layerId, getCoverage.getIdentifier().getValue()); assertEquals("image/tiff", getCoverage.getOutput().getFormat()); assertFalse(getCoverage.getOutput().isStore()); assertEquals( "urn:ogc:def:crs:EPSG:6.6:4326", getCoverage.getOutput().getGridCRS().getGridBaseCRS()); }
final GridCrsType gridCRS = request.getOutput().getGridCRS();
final GridCrsType gridCRS = request.getOutput().getGridCRS();
@Test public void testGridCS() throws Exception { Map<String, Object> raw = baseMap(); final String layerId = getLayerId(TASMANIA_BM); raw.put("identifier", layerId); raw.put("format", "image/tiff"); raw.put("BoundingBox", "-45,146,-42,147"); raw.put("GridCS", GridCS.GCSGrid2dSquare.getXmlConstant()); GetCoverageType getCoverage = (GetCoverageType) reader.read(reader.createRequest(), parseKvp(raw), raw); assertEquals( GridCS.GCSGrid2dSquare.getXmlConstant(), getCoverage.getOutput().getGridCRS().getGridCS()); raw.put("GridCS", GridCS.GCSGrid2dSquare.getXmlConstant().toUpperCase()); getCoverage = (GetCoverageType) reader.read(reader.createRequest(), parseKvp(raw), raw); assertEquals( GridCS.GCSGrid2dSquare.getXmlConstant(), getCoverage.getOutput().getGridCRS().getGridCS()); raw.put("GridCS", "Hoolabaloola"); try { reader.read(reader.createRequest(), parseKvp(raw), raw); fail("We should have had a WcsException here?"); } catch (WcsException e) { assertEquals(InvalidParameterValue.name(), e.getCode()); assertEquals("GridCS", e.getLocator()); } }
GetCoverageType getCoverage = (GetCoverageType) reader.read(reader.createRequest(), parseKvp(raw), raw); Double[] offsets = (Double[]) getCoverage.getOutput().getGridCRS().getGridOffsets(); assertEquals(2, offsets.length); assertEquals(0, Double.compare(10.5, (double) offsets[0]));
final GridCrsType gridCRS = gc.getOutput().getGridCRS(); assertEquals("urn:ogc:def:crs:EPSG:6.6:4326", gridCRS.getGridBaseCRS()); assertEquals("urn:ogc:def:method:WCS:1.1:2dSimpleGrid", gridCRS.getGridType());
"format"); final GridCrsType gridCRS = output.getGridCRS(); if (gridCRS != null) {
InvalidParameterValue, "format"); final GridCrsType gridCRS = output.getGridCRS(); if (gridCRS != null) {
Double[] origin = (Double[]) getCoverage.getOutput().getGridCRS().getGridOrigin(); assertEquals(2, origin.length); assertEquals(0, Double.compare(10.5, (double) origin[0]));
assertEquals( GridType.GT2dGridIn2dCrs.getXmlConstant(), getCoverage.getOutput().getGridCRS().getGridType()); assertEquals( GridType.GT2dSimpleGrid.getXmlConstant(), getCoverage.getOutput().getGridCRS().getGridType()); assertEquals( GridType.GT2dSimpleGrid.getXmlConstant(), getCoverage.getOutput().getGridCRS().getGridType());
Arrays.asList(90.0, 180.0), gc.getDomainSubset().getBoundingBox().getUpperCorner()); assertEquals("image/tiff", gc.getOutput().getFormat()); assertNull(gc.getOutput().getGridCRS());