Package org.geotools.coverage.io

Examples of org.geotools.coverage.io.CoverageSource


   
    @Override
    public GridCoverage2D read(String coverageName, GeneralParameterValue[] parameters)
            throws IllegalArgumentException, IOException {
        final CoverageSource gridSource = getGridCoverageSource(coverageName);
        final CoverageReadRequest request = setupCoverageRequest(parameters, gridSource);
        final CoverageResponse result = gridSource.read(request, null);
        Collection<? extends Coverage> results = result.getResults(null);
        if (results == null || results.isEmpty()) {
            if (LOGGER.isLoggable(Level.FINE)) {
                LOGGER.fine("No results have been found");
            }
View Full Code Here


            if (coverages.containsKey(coverageName)) {
                return coverages.get(coverageName);
            }

            // create, cache and return
            CoverageSource source = access.access(new NameImpl(coverageName), null,
                    AccessType.READ_ONLY, null, null);
            coverages.put(coverageName, source);
            return source;
        }
    }
View Full Code Here

        synchronized (this) {
            if (coverages != null && !coverages.isEmpty()) {
                Iterator<String> keysIt = coverages.keySet().iterator();
                while (keysIt.hasNext()) {
                    String key = keysIt.next();
                    CoverageSource sourceCov = coverages.get(key);
                    sourceCov.dispose();
                }
            }
            coverages.clear();
            coverages = null;
        }
View Full Code Here

    @Override
    public GeneralEnvelope getOriginalEnvelope(String coverageName) {
        coverageName = checkUnspecifiedCoverage(coverageName);
        try {
            CoverageSource source = getGridCoverageSource(coverageName);
            VariableAdapter.UnidataSpatialDomain spatialDomain = (UnidataSpatialDomain) source.getSpatialDomain();
            GeneralEnvelope generalEnvelope = new GeneralEnvelope(spatialDomain.getReferencedEnvelope());
            generalEnvelope.setCoordinateReferenceSystem(spatialDomain.getCoordinateReferenceSystem2D());
            return generalEnvelope;
        } catch (IOException e) {
            throw new RuntimeException(e);
View Full Code Here

    @Override
    public GridEnvelope getOriginalGridRange(String coverageName) {
        coverageName = checkUnspecifiedCoverage(coverageName);
        try {
            final CoverageSource source = getGridCoverageSource(coverageName);
            VariableAdapter.UnidataSpatialDomain spatialDomain = (UnidataSpatialDomain) source.getSpatialDomain();
            return spatialDomain.getGridGeometry().getGridRange2D();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

    @Override
    public double[] getReadingResolutions(String coverageName, OverviewPolicy policy,
            double[] requestedResolution) throws IOException {
            // Currently we have no overviews support so we will return the highest resolution
        coverageName = checkUnspecifiedCoverage(coverageName);
        final CoverageSource source = getGridCoverageSource(coverageName);
        VariableAdapter.UnidataSpatialDomain spatialDomain = (UnidataSpatialDomain) source.getSpatialDomain();
        GeneralGridGeometry gridGeometry2D = spatialDomain.getGridGeometry();
        AffineTransform gridToCRS = (AffineTransform) gridGeometry2D.getGridToCRS();
        return CoverageUtilities.getResolution(gridToCRS);
    }
View Full Code Here

   
    @Override
    public int getNumOverviews(String coverageName) {
        coverageName = checkUnspecifiedCoverage(coverageName);
        try {
            final CoverageSource source = getGridCoverageSource(coverageName);
            // Make sure that coverageName exists
            return 0;
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
View Full Code Here

    @Override
    public ImageLayout getImageLayout(String coverageName) throws IOException {
        coverageName = checkUnspecifiedCoverage(coverageName);
        try {
            final CoverageSource source = getGridCoverageSource(coverageName);
            VariableAdapter.UnidataSpatialDomain spatialDomain = (UnidataSpatialDomain) source.getSpatialDomain();
            GridEnvelope2D gridRange = spatialDomain.getGridGeometry().getGridRange2D();
            RasterLayout rasterElement = spatialDomain.getRasterElements(false, null).iterator().next();
            SampleModel sampleModel = new BandedSampleModel(DataBuffer.TYPE_DOUBLE, (int)gridRange.getWidth(), (int)gridRange.getHeight(), 1);
            ColorModel colorModel = ImageIOUtilities.createColorModel(sampleModel);
            Rectangle rect = rasterElement.toRectangle();
View Full Code Here

    @Override
    public CoordinateReferenceSystem getCoordinateReferenceSystem(String coverageName) {
        coverageName = checkUnspecifiedCoverage(coverageName);
        try {
            final CoverageSource source = getGridCoverageSource(coverageName);
            VariableAdapter.UnidataSpatialDomain spatialDomain = (UnidataSpatialDomain) source.getSpatialDomain();
            return spatialDomain.getCoordinateReferenceSystem2D();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

   
    @Override
    public MathTransform getOriginalGridToWorld(String coverageName, PixelInCell pixInCell) {
        coverageName = checkUnspecifiedCoverage(coverageName);
        try {
            final CoverageSource source = getGridCoverageSource(coverageName);
            VariableAdapter.UnidataSpatialDomain spatialDomain = (UnidataSpatialDomain) source.getSpatialDomain();
            MathTransform2D gridToWorld = spatialDomain.getGridToWorldTransform(null);
            if (pixInCell == PixelInCell.CELL_CENTER) {
                return gridToWorld;
            }
View Full Code Here

TOP

Related Classes of org.geotools.coverage.io.CoverageSource

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.