Package net.opengis.wcs20

Examples of net.opengis.wcs20.GetCoverageType


        raw.put("identifier", layerId);
        raw.put("format", "image/tiff");
        raw.put("BoundingBox", "-45,146,-42,147");
        raw.put("rangeSubset", "BlueMarble:" + interpolation + "[Bands[Red_band]]");

        GetCoverageType getCoverage = (GetCoverageType) reader.read(reader.createRequest(), parseKvp(raw), raw);
        RangeSubsetType rs = getCoverage.getRangeSubset();
        FieldSubsetType field = (FieldSubsetType) rs.getFieldSubset().get(0);
        AxisSubsetType axis = (AxisSubsetType) field.getAxisSubset().get(0);
        List keys = axis.getKey();

        assertNotNull(rs);
View Full Code Here


                "  <wcs:Output format=\"image/tiff\"/>\r\n" + //
                "</wcs:GetCoverage>";
        // System.out.println(request);

        // smoke test, we only try out a very basic request
        GetCoverageType gc = (GetCoverageType) reader.read(null, new StringReader(request), null);
        assertEquals("WCS", gc.getService());
        assertEquals("1.1.1", gc.getVersion());
        assertEquals("wcs:BlueMarble", gc.getIdentifier().getValue());
        assertEquals("urn:ogc:def:crs:EPSG:6.6:4326", gc.getDomainSubset().getBoundingBox()
                .getCrs());
        assertEquals(Arrays.asList(-90.0, -180.0), gc.getDomainSubset().getBoundingBox()
                .getLowerCorner());
        assertEquals(Arrays.asList(90.0, 180.0), gc.getDomainSubset().getBoundingBox()
                .getUpperCorner());
        assertEquals("image/tiff", gc.getOutput().getFormat());
        assertNull(gc.getOutput().getGridCRS());
    }
View Full Code Here

                "    </wcs:FieldSubset>\r\n" + //
                "  </wcs:RangeSubset>\r\n" + //
                "  <wcs:Output format=\"image/tiff\"/>\r\n" + //
                "</wcs:GetCoverage>";

        GetCoverageType gc = (GetCoverageType) reader.read(null, new StringReader(request), null);
        assertEquals(1, gc.getRangeSubset().getFieldSubset().size());
        FieldSubsetType field = (FieldSubsetType) gc.getRangeSubset().getFieldSubset().get(0);
        assertEquals("BlueMarble", field.getIdentifier().getValue());
        assertEquals("bicubic", field.getInterpolationType());
        assertEquals(1, field.getAxisSubset().size());
        AxisSubsetType axis = (AxisSubsetType) field.getAxisSubset().get(0);
        assertEquals("Bands", axis.getIdentifier());
View Full Code Here

                "      <wcs:GridCS>urn:ogc:def:cs:OGC:0.0:Grid2dSquareCS</wcs:GridCS>\r\n" + //
                "    </wcs:GridCRS>\r\n" + //
                "  </wcs:Output>\r\n" + //
                "</wcs:GetCoverage>";

        GetCoverageType gc = (GetCoverageType) reader.read(null, new StringReader(request), null);
        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());
        assertEquals("urn:ogc:def:cs:OGC:0.0:Grid2dSquareCS", gridCRS.getGridCS());
        System.out.println(gridCRS.getGridOrigin().getClass() + ": " + gridCRS.getGridOrigin());
        assertTrue(Arrays.equals(new Double[] { 10.0, 20.0 }, (Double[]) gridCRS.getGridOrigin()));
View Full Code Here

    public String getPreferredDisposition(Object value, Operation operation) {
        return DISPOSITION_ATTACH;
    }
   
    public String getAttachmentFileName(Object value, Operation operation) {
        final GetCoverageType request = (GetCoverageType) operation.getParameters()[0];
        final String identifier = request.getIdentifier().getValue();
        return identifier.replace(':', '_') + ".eml";
       
    }
View Full Code Here

    public boolean canHandle(Operation operation) {
        // this one can handle GetCoverage responses where store = false
        if(!(operation.getParameters()[0] instanceof GetCoverageType))
            return false;
       
        GetCoverageType getCoverage = (GetCoverageType) operation.getParameters()[0];
        return !getCoverage.getOutput().isStore();
    }
View Full Code Here

    public void write(Object value, OutputStream output, Operation operation) throws IOException,
            ServiceException {
        GridCoverage[] coverages = (GridCoverage[]) value;

        // grab the delegate for coverage encoding
        GetCoverageType request = (GetCoverageType) operation.getParameters()[0];
        String outputFormat = request.getOutput().getFormat();
        CoverageResponseDelegate delegate = responseFactory.encoderFor(outputFormat);
        if (delegate == null)
            throw new WcsException("Could not find encoder for output format " + outputFormat);

        // grab the coverage info for Coverages document encoding
        final GridCoverage2D coverage = (GridCoverage2D) coverages[0];
        CoverageInfo coverageInfo = catalog.getCoverageByName(request.getIdentifier().getValue());

        // use javamail classes to actually encode the document
        try {
            // coverages xml structure (always set the headers after the data
            // handlers, setting
View Full Code Here

    public boolean canHandle(Operation operation) {
        // this one can handle GetCoverage responses where store = false
        if(!(operation.getParameters()[0] instanceof GetCoverageType))
            return false;
       
        GetCoverageType getCoverage = (GetCoverageType) operation.getParameters()[0];
        return getCoverage.getOutput().isStore();
    }
View Full Code Here

    public void write(Object value, OutputStream output, Operation operation) throws IOException,
            ServiceException {
        GridCoverage[] coverages = (GridCoverage[]) value;

        // grab the delegate for coverage encoding
        GetCoverageType request = (GetCoverageType) operation.getParameters()[0];
        String outputFormat = request.getOutput().getFormat();
        CoverageResponseDelegate delegate = responseFactory.encoderFor(outputFormat);
        if (delegate == null)
            throw new WcsException("Could not find encoder for output format " + outputFormat);

        // grab the coverage info for Coverages document encoding
        final GridCoverage2D coverage = (GridCoverage2D) coverages[0];
        CoverageInfo coverageInfo = catalog.getCoverageByName(request.getIdentifier().getValue());
       
        // write the coverage to temporary storage in the data dir
        File wcsStore = null;
        try {
            GeoServerResourceLoader loader = geoServer.getCatalog().getResourceLoader();
            Resource wcs = loader.get("temp/wcs");
            wcsStore = wcs.dir();
//            File temp = GeoserverDataDirectory.findCreateConfigDir("temp");
//            wcsStore = new File(temp, "wcs");
//            if(!wcsStore.exists())
//                wcsStore.mkdir();
        } catch(Exception e) {
            throw new WcsException("Could not create the temporary storage directory for WCS");
        }
       
        // Make sure we create a file name that's not already there (even if splitting the same nanosecond
        // with two requests should not ever happen...)
        File coverageFile = null;
        while(true) {
            // TODO: find a way to get good extensions
            coverageFile = new File(wcsStore, coverageInfo.getName().replace(':', '_') + "_" + System.nanoTime() + "." + delegate.getFileExtension(outputFormat));
            if(!coverageFile.exists())
                break;
        }
      
        // store the coverage
        OutputStream os = null;
        try {
            os = new BufferedOutputStream(new FileOutputStream(coverageFile));
            delegate.encode(coverage, outputFormat,Collections.EMPTY_MAP, os);
            os.flush();
        } finally {
            if(os != null) os.close();
        }
        System.out.println(coverageFile);
       
        // build the path where the clients will be able to retrieve the coverage files
        final String coverageLocation = buildURL(request.getBaseUrl(),
                appendPath("temp/wcs", coverageFile.getName()), null, URLType.RESOURCE);
       
        // build the response
        WCSInfo wcs = geoServer.getService(WCSInfo.class);
        CoveragesTransformer tx = new CoveragesTransformer(wcs, request, coverageLocation);
View Full Code Here

        if (dcov != null) {
            qualifyNames(dcov.getIdentifier(), ws);
            return;
        }
           
        GetCoverageType gcov = parameter(operation, GetCoverageType.class);
        if (gcov != null) {
            if (gcov.getIdentifier() != null && gcov.getIdentifier().getValue() != null) {
                gcov.getIdentifier().setValue(qualifyName(gcov.getIdentifier().getValue(), ws));
            }
           
        }
    }
View Full Code Here

TOP

Related Classes of net.opengis.wcs20.GetCoverageType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.