Package org.geoserver.wcs2_0.kvp

Examples of org.geoserver.wcs2_0.kvp.InterpolationKvpParserTest


            String fileName = "/coverages/" + getCoverage.getCoverageId() + "." + delegate.getFileExtension(format);
           
            // coverages xml structure, which is very close to the DescribeFeatureType output
            BodyPart coveragesPart = new MimeBodyPart();
            FileReference reference = new FileReference(fileName, delegate.getMimeType(format), delegate.getConformanceClass(format));
            final CoverageData coveragesData = new CoverageData(coverage, reference, envelopeDimensionsMapper);
            coveragesPart.setDataHandler(new DataHandler(coveragesData, "geoserver/coverages20"));
            coveragesPart.setHeader("Content-ID", "wcs");
            coveragesPart.setHeader("Content-Type", "application/gml+xml");
            multipart.addBodyPart(coveragesPart);
View Full Code Here


        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());
    }
View Full Code Here

        }
        if (!(sourceCoverage instanceof GranuleStack)) {
            throw new IllegalArgumentException(
                    "NetCDF encoding only supports granuleStack coverages");
        }
        GranuleStack granuleStack = (GranuleStack) sourceCoverage;

        // GZIPOutputStream gzipOut = null;
        // if (isOutputCompressed(outputFormat)) {
        // gzipOut = new GZIPOutputStream(output);
        // output = gzipOut;
View Full Code Here

                    }
                }
                final List<DimensionBean> dimensions = helper.setupDimensions();
                final String nativeName = cinfo.getNativeCoverageName();
                final String coverageName = nativeName != null ? nativeName : reader.getGridCoverageNames()[0];
                final GranuleStackImpl stack = new GranuleStackImpl(coverageName, reader.getCoordinateReferenceSystem(), dimensions);
                // Geoserver max memory limit definition
                long outputLimit = wcs.getMaxOutputMemory() * 1024;
                long inputLimit = wcs.getMaxInputMemory() * 1024;
                // Object value used for storing the sum of the output size of each internal coverage
                ImageSizeRecorder incrementalOutputSize=new ImageSizeRecorder(outputLimit,false);
                // Object used for storing the sum of the output size of each internal coverage
                ImageSizeRecorder incrementalInputSize=new ImageSizeRecorder(inputLimit,true);
                // Image size estimation
                final int numRequests = requests.size();
                final Iterator<GridCoverageRequest> requestsIterator = requests.iterator();
                GridCoverageRequest firstRequest = requestsIterator.next();
                GridCoverage2D firstCoverage = setupCoverage(helper, firstRequest, request, reader, hints, extensions, dimensions,
                        incrementalOutputSize, incrementalInputSize, coverageFactory);
                // check the first coverage memory usage
                long actual = incrementalInputSize.finalSize();
                // Estimated size
                long estimatedSize = actual*numRequests;
                //Check if the estimated size is greater than that of the maximum output memory
                // Limit check is performed only when the limit is defined
                if(outputLimit > 0 && estimatedSize > outputLimit){
                    throw new WcsException("This request is trying to generate too much data, " +
                            "the limit is " + formatBytes(outputLimit) + " but the estimated amount of bytes to be " +
                                    "written in the output is " + formatBytes(estimatedSize));
                }
                // If the estimated size does not exceed the limit, the first coverage is added to the GranuleStack
                stack.addCoverage(firstCoverage);

                // Get a coverage for each subrequest
                while (requestsIterator.hasNext()) {
                    GridCoverageRequest subRequest = requestsIterator.next();
                    GridCoverage2D singleCoverage = setupCoverage(helper, subRequest, request, reader, hints, extensions, dimensions,
                            incrementalOutputSize, incrementalInputSize, coverageFactory);
                    stack.addCoverage(singleCoverage);
                }
                coverage = stack;
            } else {
                // IncrementalSize not used
                coverage = setupCoverage(helper, gcr, request, reader, hints, extensions, null, null, null, coverageFactory);
View Full Code Here

            String mergedIds = StringUtils.merge(badCoverageIds);
            throw new WCS20Exception("Could not find the requested coverage(s): " + mergedIds,
                    new OWSExceptionCode("noSuchEODataset", 404), "eoid");
        }

        WCS20DescribeCoverageTransformer tx = new WCS20DescribeCoverageTransformer(
                getServiceInfo(), catalog, responseFactory, envelopeAxesMapper, mimemapper);
        return new DescribeEOCoverageSetTransformer(getServiceInfo(), resourceCodec, envelopeAxesMapper, tx);
    }
View Full Code Here

                    , WCS20Exception.WCS20ExceptionCode.NoSuchCoverage, "coverageId");
        }

        WCSInfo wcs = getServiceInfo();

        WCS20DescribeCoverageTransformer describeTransformer = new WCS20DescribeCoverageTransformer(wcs, catalog, responseFactory,envelopeAxesMapper,mimemapper);
        describeTransformer.setEncoding(Charset.forName(wcs.getGeoServer().getSettings().getCharset()));
        return describeTransformer;
    }
View Full Code Here

        setIndentation(2);
    }

    @Override
    public Translator createTranslator(ContentHandler handler) {
        WCS20DescribeCoverageTranslator dcTranslator = dcTransformer.createTranslator(handler);
        return new WCS20DescribeEOCoverageSetTranslator(handler, dcTranslator);
    }
View Full Code Here

            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 {
            throw new WCS20Exception("Internal error: Could not understand version:" + negotiatedVersion,
                    OWS20Exception.OWSExceptionCode.VersionNegotiationFailed, negotiatedVersion);
        }
View Full Code Here

                    // the dataset series id
                    element("wcseo:DatasetSeriesId", datasetId);

                    // encode the time
                    DimensionInfo time = ci.getMetadata().get(ResourceInfo.TIME, DimensionInfo.class);
                    WCSDimensionsHelper timeHelper = new WCSDimensionsHelper(time, reader, datasetId);
                    dcTranslator.encodeTimePeriod(timeHelper.getBeginTime(), timeHelper.getEndTime(), datasetId + "_timeperiod", null, null);

                    end("wcseo:DatasetSeriesDescription");
                } catch (IOException e) {
                    throw new WCS20Exception("Failed to build the description for dataset series "
                            + codec.getDatasetName(ci), e);
View Full Code Here

                "associated time, cannot add EO metadata to it: "+ ci.prefixedName());
            return;
        }
        GridCoverage2DReader reader = (GridCoverage2DReader) ci.getGridCoverageReader(null, null);
        String coverageId = NCNameResourceCodec.encode(ci);
        WCSDimensionsHelper dimensionHelper = new WCSDimensionsHelper(time, reader, coverageId);
        tx.start("wcseo:EOMetadata");
        tx.start("eop:EarthObservation", atts("gml:id", coverageId + "_metadata"));
       
        // phenomenon time
        tx.start("om:phenomenonTime");
        tx.start("gml:TimePeriod", atts("gml:id", coverageId + "_tp"));
        element(tx, "gml:beginPosition", dimensionHelper.getBeginTime(), null);
        element(tx, "gml:endPosition", dimensionHelper.getEndTime(), null);
        tx.end("gml:TimePeriod");
        tx.end("om:phenomenonTime");
       
        // resultTime
        tx.start("om:resultTime");
        tx.start("gml:TimeInstant", atts("gml:id", coverageId + "_rt"));
        element(tx, "gml:timePosition", dimensionHelper.getEndTime(), null);
        tx.end("gml:TimeInstant");
        tx.end("om:resultTime");
       
        // some empty elements...
        element(tx, "om:procedure", null, null);
View Full Code Here

TOP

Related Classes of org.geoserver.wcs2_0.kvp.InterpolationKvpParserTest

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.