Package org.geoserver.wcs2_0.response

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


     *
     * @return
     * @throws IOException
     */
    public GridCoverageRequest createGridCoverageRequestSubset() throws IOException {
        final WCSEnvelope spatialSubset = extractSubsettingEnvelope();
        assert spatialSubset != null && !spatialSubset.isEmpty();
       
        Map<String, List<Object>> dimensionsSubset = null;
        DateRange temporalSubset = null;
        NumberRange elevationSubset = null;

View Full Code Here


        return query;
    }

    private Filter filterSpatial(GridCoverageRequest gcr,
            StructuredGridCoverage2DReader reader, GranuleSource source) throws IOException, MismatchedDimensionException, TransformException, FactoryException {
        WCSEnvelope envelope = gcr.getSpatialSubset();
        Polygon llPolygon = JTS.toGeometry(new ReferencedEnvelope(envelope));
        GeometryDescriptor geom = source.getSchema().getGeometryDescriptor();
        PropertyName geometryProperty = ff.property(geom.getLocalName());
        Geometry nativeCRSPolygon = JTS.transform(llPolygon, CRS.findMathTransform(envelope.getCoordinateReferenceSystem(), reader.getCoordinateReferenceSystem()));
        Literal polygonLiteral = ff.literal(nativeCRSPolygon);
//                    if(overlaps) {
        return ff.intersects(geometryProperty, polygonLiteral);
//                    } else {
//                        filter = ff.within(geometryProperty, polygonLiteral);
View Full Code Here

                    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

                    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);
                }
            }
            end("wcseo:DatasetSeriesDescriptions");
        }
View Full Code Here

                        List<DimensionDescriptor> descriptors = getActiveDimensionDescriptor(ci, reader, name);
                        CoverageGranules granules = new CoverageGranules(ci, name, reader, collection, descriptors);
                        results.add(granules);
                    }
                } catch (IOException e) {
                    throw new WCS20Exception("Failed to load the coverage granules for covearge "
                            + ci.prefixedName(), e);
                } finally {
                    try {
                        if (source != null) {
                            source.dispose();
View Full Code Here

            NumberRange<Double> latRange = null;
            for (DimensionTrimType trim : dcs.getDimensionTrim()) {
                String name = trim.getDimension();
                if ("Long".equals(name)) {
                    if (lonRange != null) {
                        throw new WCS20Exception("Long trim specified more than once",
                                OWSExceptionCode.InvalidParameterValue, "subset");
                    }
                    lonRange = parseNumberRange(trim);
                } else if ("Lat".equals(name)) {
                    if (latRange != null) {
                        throw new WCS20Exception("Lat trim specified more than once",
                                OWSExceptionCode.InvalidParameterValue, "subset");
                    }
                    latRange = parseNumberRange(trim);
                } else if ("phenomenonTime".equals(name)) {
                    if (timeRange != null) {
                        throw new WCS20Exception("phenomenonTime trim specified more than once",
                                OWSExceptionCode.InvalidParameterValue, "subset");
                    }
                    timeRange = parseDateRange(trim);
                } else {
                    throw new WCS20Exception("Invalid dimension name " + name
                            + ", the only valid values "
                            + "by WCS EO spec are Long, Lat and phenomenonTime",
                            OWSExceptionCode.InvalidParameterValue, "subset");
                }
            }

            // check the desired containment
            boolean overlaps;
            String containment = dcs.getContainmentType();
            if (containment == null || "overlaps".equals(containment)) {
                overlaps = true;
            } else if ("contains".equals(containment)) {
                overlaps = false;
            } else {
                throw new WCS20Exception("Invalid containment value " + containment
                        + ", the only valid values by WCS EO spec are contains and overlaps",
                        OWSExceptionCode.InvalidParameterValue, "containment");
            }

            // spatial subset
            FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();
            Filter filter = null;
            if (lonRange != null || latRange != null) {
                try {
                    // we are going to intersect the trims with the original envelope
                    // since the trims can only be expressed in wgs84 we need to reproject back and forth
                    ReferencedEnvelope original = new ReferencedEnvelope(reader.getOriginalEnvelope())
                            .transform(DefaultGeographicCRS.WGS84, true);
                    if (lonRange != null) {
                        ReferencedEnvelope lonTrim = new ReferencedEnvelope(lonRange.getMinimum(),
                                lonRange.getMaximum(), -90, 90, DefaultGeographicCRS.WGS84);
                        original = new ReferencedEnvelope(original.intersection(lonTrim), DefaultGeographicCRS.WGS84);
                    }
                    if (latRange != null) {
                        ReferencedEnvelope latTrim = new ReferencedEnvelope(-180, 180,
                                latRange.getMinimum(), latRange.getMaximum(),
                                DefaultGeographicCRS.WGS84);
                        original = new ReferencedEnvelope(original.intersection(latTrim), DefaultGeographicCRS.WGS84);
                    }
                    if (original.isEmpty()) {
                        filter = Filter.EXCLUDE;
                    } else {
                        Polygon llPolygon = JTS.toGeometry(original);
                        GeometryDescriptor geom = reader.getGranules(coverageName, true).getSchema().getGeometryDescriptor();
                        PropertyName geometryProperty = ff.property(geom.getLocalName());
                        Geometry nativeCRSPolygon = JTS.transform(llPolygon, CRS.findMathTransform(DefaultGeographicCRS.WGS84, reader.getCoordinateReferenceSystem()));
                        Literal polygonLiteral = ff.literal(nativeCRSPolygon);
                        if(overlaps) {
                            filter = ff.intersects(geometryProperty, polygonLiteral);
                        } else {
                            filter = ff.within(geometryProperty, polygonLiteral);
                        }
                    }
                } catch(Exception e) {
                    throw new WCS20Exception("Failed to translate the spatial trim into a native filter", e);
                }
            }

            // temporal subset
            if (timeRange != null && filter != Filter.EXCLUDE) {
View Full Code Here

                final Date low = xmlTimeConverter.parseDateTime(trim.getTrimLow()).getTime();
                final Date high = xmlTimeConverter.parseDateTime(trim.getTrimHigh()).getTime();

                // low > high???
                if (low.compareTo(high) > 0) {
                    throw new WCS20Exception("Low greater than High in trim for dimension: "
                            + trim.getDimension(),
                            WCS20Exception.WCS20ExceptionCode.InvalidSubsetting, "dimensionTrim");
                }

                return new DateRange(low, high);
            } catch (IllegalArgumentException e) {
                throw new WCS20Exception("Invalid date value",
                        OWSExceptionCode.InvalidParameterValue, "dimensionTrim", e);
            }

        }
View Full Code Here

                double low = Double.parseDouble(trim.getTrimLow());
                double high = Double.parseDouble(trim.getTrimHigh());

                // low > high???
                if (low > high) {
                    throw new WCS20Exception("Low greater than High in trim for dimension: "
                            + trim.getDimension(),
                            WCS20Exception.WCS20ExceptionCode.InvalidSubsetting, "dimensionTrim");
                }

                return new NumberRange<Double>(Double.class, low, high);
            } catch (NumberFormatException e) {
                throw new WCS20Exception("Invalid numeric value",
                        OWSExceptionCode.InvalidParameterValue, "dimensionTrim", e);
            }
        }
View Full Code Here

                badCoverageIds.add(datasetId);
            }
        }
        if (!badCoverageIds.isEmpty()) {
            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);
View Full Code Here

        if(parameters != null && parameters.length > 0 && parameters[0] instanceof GetCoverageType) {
            // check we are going against a granule
            GetCoverageType gc = (GetCoverageType) parameters[0];
            String coverageId = gc.getCoverageId();
            if(coverageId == null) {
                throw new WCS20Exception("Required parameter coverageId is missing",
                        WCS20Exception.WCS20ExceptionCode.MissingParameterValue, "coverageId");
            }
            CoverageInfo coverage = codec.getGranuleCoverage(coverageId);
            if(coverage != null) {
                // set the actual coverage name
                String actualCoverageId = NCNameResourceCodec.encode(coverage);
                gc.setCoverageId(actualCoverageId);
               
                // extract the granule filter
                Filter granuleFilter = codec.getGranuleFilter(coverageId);
               
                // check the filter actually matches one granule
                if(!readerHasGranule(coverage, granuleFilter)) {
                    throw new WCS20Exception("Could not locate coverage " + coverageId, WCS20ExceptionCode.NoSuchCoverage, "coverageId");
                }
               
                // set and/or merge with the previous filter
                Filter previous = gc.getFilter();
                if(previous == null || previous == Filter.INCLUDE) {
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.