Package org.geoserver.wcs2_0.response

Examples of org.geoserver.wcs2_0.response.WCS20CoverageMetadataProvider$Translator


                    }
                }
                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

                String datasetId = codec.getDatasetName(ci);
                element(tx, "wcseo:DatasetSeriesId", datasetId, null);

                GridCoverage2DReader reader = (GridCoverage2DReader) ci.getGridCoverageReader(null, null);

                WCSDimensionsHelper dimensionsHelper = new WCSDimensionsHelper(time, reader, null);
                tx.start("gml:TimePeriod", atts("gml:id", datasetId + "__timeperiod"));
                element(tx, "gml:beginPosition", dimensionsHelper.getBeginTime(), null);
                element(tx, "gml:endPosition", dimensionsHelper.getEndTime(), null);
                tx.end("gml:TimePeriod");
                tx.end("wcseo:DatasetSeriesSummary");
            }
        }
    }
View Full Code Here

            // get a reader for this coverage
            final GridCoverage2DReader reader = (GridCoverage2DReader) cinfo.getGridCoverageReader(
                    new DefaultProgressListener(),
                    hints);

            WCSDimensionsSubsetHelper helper = parseGridCoverageRequest(cinfo, reader, request, extensions);
            GridCoverageRequest gcr = helper.getGridCoverageRequest();

            //TODO consider dealing with the Format instance instead of a String parsing or check against WCSUtils.isSupportedMDOutputFormat(String).
            final GridCoverageFactory coverageFactory = CoverageFactoryFinder.getGridCoverageFactory(hints);
            if (reader instanceof StructuredGridCoverage2DReader && formatSupportMDOutput(request.getFormat())) {
                // Split the main request into a List of requests in order to read more coverages to be stacked
                final Set<GridCoverageRequest> requests = helper.splitRequestToSet();
                if (requests == null || requests.isEmpty()) {
                    throw new IllegalArgumentException("Splitting requests returned nothing");
                } else {
                    if (LOGGER.isLoggable(Level.FINE)) {
                        LOGGER.fine("Splitting request generated " + requests.size() + " sub requests");
                    }
                }
                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;
 
View Full Code Here

        //
        final CoordinateReferenceSystem subsettingCRS = extractSubsettingCRS(reader, extensions);
        final CoordinateReferenceSystem outputCRS = extractOutputCRS(reader, extensions,
                subsettingCRS);

        WCSDimensionsSubsetHelper subsetHelper = new WCSDimensionsSubsetHelper(reader, request, ci, subsettingCRS, envelopeDimensionsMapper);

        // extract dimensions subsetting
        GridCoverageRequest requestSubset = subsetHelper.createGridCoverageRequestSubset();

        //
        // Handle interpolation extension
        //
        // notice that for the moment we support only homogeneous interpolation on the 2D axis
        final Map<String, InterpolationPolicy> axesInterpolations = extractInterpolation(reader,
                extensions);
        final Interpolation spatialInterpolation = extractSpatialInterpolation(axesInterpolations,
                reader.getOriginalEnvelope());
        final OverviewPolicy overviewPolicy = extractOverviewPolicy(extensions);
        // TODO time interpolation
        assert spatialInterpolation != null;

        // build the grid coverage request
        GridCoverageRequest gcr = new GridCoverageRequest();
        gcr.setOutputCRS(outputCRS);
        gcr.setSpatialInterpolation(spatialInterpolation);
        gcr.setSpatialSubset(requestSubset.getSpatialSubset());
        gcr.setTemporalSubset(requestSubset.getTemporalSubset());
        gcr.setElevationSubset(requestSubset.getElevationSubset());
        gcr.setDimensionsSubset(requestSubset.getDimensionsSubset());
        gcr.setFilter(request.getFilter());
        gcr.setOverviewPolicy(overviewPolicy);
        subsetHelper.setGridCoverageRequest(gcr);
        return subsetHelper;
    }
View Full Code Here

TOP

Related Classes of org.geoserver.wcs2_0.response.WCS20CoverageMetadataProvider$Translator

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.