Package org.geotools.coverage.io.impl

Examples of org.geotools.coverage.io.impl.DefaultCoverageReadRequest


                    if (gridSource == null)
                        throw new IOException("");
                    // create a request
                    // reading the coverage
                    CoverageResponse response = gridSource.read(
                            new DefaultCoverageReadRequest(), null);
                    if (response == null
                            || response.getStatus() != Status.SUCCESS
                            || !response.getExceptions().isEmpty())
                        throw new IOException("");

                    Collection<? extends Coverage> results = response
                            .getResults(null);
                    for (Coverage c : results) {
                        GridCoverage2D coverage = (GridCoverage2D) c;
                        // Crs and envelope
                        if (TestData.isInteractiveTest()) {
                            buffer.append("CRS: ").append(
                                    coverage.getCoordinateReferenceSystem2D()
                                            .toWKT()).append("\n");
                            buffer.append("GG: ").append(
                                    coverage.getGridGeometry().toString())
                                    .append("\n");
                        }

                        // create an update request
                        final DefaultCoverageUpdateRequest request = new DefaultCoverageUpdateRequest();
                        request.setData(Collections.singletonList(coverage));

                        // create access

                        final File writeFile = new File(writedir, coverage
                                .getName().toString()
                                + ".tiff");
                        final GeoTiffAccess storeAccess =
                          (GeoTiffAccess) factory.process(
                              DriverOperation.CREATE,
                              writeFile.toURI().toURL(),
                              null,
                              null,
                              null);
                        final CoverageStore gridStore = (CoverageStore) storeAccess
                                .create(name, null, null, null);

                        // write it down
                        gridStore.update(request, null);

                        // getting access to the file
                        access = factory.process(DriverOperation.CONNECT,writeFile.toURI().toURL(),null, null, null);
                        if (access == null)
                            throw new IOException("");

                        //get the names
                        names = access.getNames(null);
                        gridSource = access.access(names.iterator().next(),
                                null, AccessType.READ_ONLY, null, null);
                        if (gridSource == null)
                            throw new IOException("");
                        //create a request
                        // reading the coverage
                        response = gridSource.read(
                                new DefaultCoverageReadRequest(), null);
                        if (response == null
                                || response.getStatus() != Status.SUCCESS
                                || !response.getExceptions().isEmpty())
                            throw new IOException("");
View Full Code Here


                throw new IOException("");
              // create a request
              // reading the coverage
              watch = new TestProgress();
              CoverageResponse response = gridSource.read(
                  new DefaultCoverageReadRequest(), watch);
              assertEquals("read progress", 1.0f, watch
                  .getProgress());

              assertNotNull("response is null", response);
              assertEquals("response success", Status.SUCCESS,
View Full Code Here

TOP

Related Classes of org.geotools.coverage.io.impl.DefaultCoverageReadRequest

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.