Examples of GridCoverage


Examples of org.opengis.coverage.grid.GridCoverage

   * @throws IOException
   * @throws IllegalArgumentException
   */
  public Set<Double> computeUniqueValues(GridCoverageReader layer, Long sampleSize, IProgressMonitor monitor) throws IllegalArgumentException, IOException{
    this.errorMessage = null;
    GridCoverage gcRaw = layer.read(null);
    if (sampleSize != null){
      int rSize = (int) Math.ceil(Math.sqrt(sampleSize.doubleValue()));
      GridEnvelope2D gridRange = new GridEnvelope2D(new Rectangle(0,0, rSize, rSize));
      GridGeometry2D world = new GridGeometry2D(gridRange,  new ReferencedEnvelope(gcRaw.getEnvelope()));
      DefaultParameterDescriptor<GridGeometry> gridGeometryDescriptor = new DefaultParameterDescriptor<GridGeometry>(
          AbstractGridFormat.READ_GRIDGEOMETRY2D.getName()
              .toString(), GridGeometry.class, null, world);

      ParameterGroup readParams = new ParameterGroup(
          new DefaultParameterDescriptorGroup(
              "Test", //$NON-NLS-1$
              new GeneralParameterDescriptor[] { gridGeometryDescriptor }));

      List<GeneralParameterValue> list = readParams.values();
      GeneralParameterValue[] values = list
          .toArray(new GeneralParameterValue[0]);
      gcRaw = layer.read(values);
    }
           
    if (monitor.isCanceled()){
      return null;
    }
    GridCoordinates high = gcRaw.getGridGeometry().getGridRange().getHigh();
    GridCoordinates low = gcRaw.getGridGeometry().getGridRange().getLow();
    int width = high.getCoordinateValue(0) - low.getCoordinateValue(0);
    int height = high.getCoordinateValue(1) - low.getCoordinateValue(1);
   
    if (width * height > WARN_VALUE){
      if (!warnLargeSize()){
        return null;
      }
    }
   
    int recSize = 1000;
    boolean maxReached = false;
    HashSet<Double> results = new HashSet<Double>();
    for (int x = 0; x < width; x+=recSize){
      for (int y = 0; y < height; y += recSize){
        int w = recSize;
        int h = recSize;
        if (x + recSize > width){
          w = width - x;
        }
        if (y + recSize > height){
          h = height - y;
        }
        Rectangle r = new Rectangle(x, y, w, h);
       
        Raster rs = gcRaw.getRenderedImage().getData(r);
        DataBuffer df  = rs.getDataBuffer();
        for (int i = 0; i < df.getSize(); i ++){
          results.add(df.getElemDouble(i));
          if (results.size() >= SingleBandEditorPage.MAX_ENTRIES){
            errorMessage = MessageFormat.format(Messages.UniqueValuesDialog_MaxValueError, SingleBandEditorPage.MAX_ENTRIES);
View Full Code Here

Examples of org.opengis.coverage.grid.GridCoverage

      //
      // /////////////////////////////////////////////////////////
      parameters.put(AbstractGridFormat.READ_GRIDGEOMETRY2D.getName().toString(),
          new GridGeometry2D(new GeneralGridEnvelope(destinationSize), destinationEnvelopeInSourceCRS));
 
      final GridCoverage coverage = coverageReader.read(CoverageUtils.getParameters(
                  coverageReader.getFormat().getReadParameters(), parameters, true));
 
      if ((coverage == null) || !(coverage instanceof GridCoverage2D)) {
          throw new IOException("The requested coverage could not be found.");
      }
 
      /**
       * Band Select
       */
      /*
      Coverage bandSelectedCoverage = null;
 
      bandSelectedCoverage = WCSUtils.bandSelect(request.getParameters(), coverage);
    */
      /**
       * Crop
       */
      final GridCoverage2D croppedGridCoverage = WCSUtils.crop(coverage,
              (GeneralEnvelope) coverage.getEnvelope(), cvCRS, destinationEnvelopeInSourceCRS,
              Boolean.TRUE);
 
      /**
       * Scale/Resampling (if necessary)
       */
 
View Full Code Here

Examples of org.opengis.coverage.grid.GridCoverage

 
      GetLegendGraphicRequest req = new GetLegendGraphicRequest(getWMS());
      CoverageInfo cInfo = getCatalog().getCoverageByName("world");
      assertNotNull(cInfo);
     
        GridCoverage coverage = cInfo.getGridCoverage(null, null);
        FeatureCollection<SimpleFeatureType, SimpleFeature> feature;
        feature = FeatureUtilities.wrapGridCoverage((GridCoverage2D) coverage);
        req.setLayer(feature.getSchema());
      req.setStyle(multipleRulesStyle);
      req.setLegendOptions(new HashMap());
View Full Code Here

Examples of org.opengis.coverage.grid.GridCoverage

        //
        // Reading the coverage
        //
        // /////////////////////////////////////////////////////////
       
        GridCoverage gc  = reader.read(CoverageUtils.getParameters(
                    reader.getFormat().getReadParameters(), info.getParameters()));
       
        if ((gc == null) || !(gc instanceof GridCoverage2D)) {
            throw new IOException("The requested coverage could not be found.");
        }
View Full Code Here

Examples of org.opengis.coverage.grid.GridCoverage

        raw.put("format", "image/geotiff");
        raw.put("BoundingBox", "-45,146,-42,147,urn:ogc:def:crs:EPSG:6.6:4326");
        raw.put("GridBaseCRS", "urn:ogc:def:crs:EPSG:6.6:4326");

        GridCoverage[] coverages = executeGetCoverageKvp(raw);
        GridCoverage original = getCatalog().getCoverageByName(getLayerId).getGridCoverage(null, null);

        final AffineTransform2D originalTx = (AffineTransform2D) original.getGridGeometry()
                .getGridToCRS();
        final AffineTransform2D flippedTx = (AffineTransform2D) coverages[0].getGridGeometry()
                .getGridToCRS();
        assertEquals(originalTx.getScaleX(), flippedTx.getShearY(), EPS);
        assertEquals(originalTx.getScaleY(), flippedTx.getShearX(), EPS);
View Full Code Here

Examples of org.opengis.coverage.grid.GridCoverage

            throw new WcsException("Output format: " + outputFormat + " not supported by geoserver " +
                "for this Coverage", WcsExceptionCode.InvalidParameterValue, "format");

        final Catalog catalog = request.getWCS().getGeoServer().getCatalog();
        CoverageInfo meta = null;
        GridCoverage coverage = null;

        try {
            meta = catalog.getCoverageByName(request.getCoverage());

            if (!meta.getSupportedFormats().contains(outputFormat.toUpperCase())) {
View Full Code Here

Examples of org.opengis.coverage.grid.GridCoverage

        //
        // /////////////////////////////////////////////////////////
        parameters.put(AbstractGridFormat.READ_GRIDGEOMETRY2D.getName().toString(),
            new GridGeometry2D(new GeneralGridEnvelope(destinationSize), destinationEnvelopeInSourceCRS));

        final GridCoverage coverage = coverageReader.read(CoverageUtils.getParameters(
                    coverageReader.getFormat().getReadParameters(), parameters, true));

        if ((coverage == null) || !(coverage instanceof GridCoverage2D)) {
            throw new IOException("The requested coverage could not be found.");
        }

        /**
         * Band Select
         */
        Coverage bandSelectedCoverage = null;

        bandSelectedCoverage = WCSUtils.bandSelect(request.getParameters(), coverage);

        /**
         * Crop
         */
        final GridCoverage2D croppedGridCoverage = WCSUtils.crop(bandSelectedCoverage,
                (GeneralEnvelope) coverage.getEnvelope(), cvCRS, destinationEnvelopeInSourceCRS,
                Boolean.TRUE);

        /**
         * Scale/Resampling (if necessary)
         */
 
View Full Code Here

Examples of org.opengis.coverage.grid.GridCoverage

      //
      // /////////////////////////////////////////////////////////
      parameters.put(AbstractGridFormat.READ_GRIDGEOMETRY2D.getName().toString(),
          new GridGeometry2D(new GeneralGridEnvelope(destinationSize), destinationEnvelopeInSourceCRS));
 
      final GridCoverage coverage = coverageReader.read(CoverageUtils.getParameters(
                  coverageReader.getFormat().getReadParameters(), parameters, true));
 
      if ((coverage == null) || !(coverage instanceof GridCoverage2D)) {
          throw new IOException("The requested coverage could not be found.");
      }
 
      /**
       * Band Select
       */
      /*
      Coverage bandSelectedCoverage = null;
 
      bandSelectedCoverage = WCSUtils.bandSelect(request.getParameters(), coverage);
    */
      /**
       * Crop
       */
      final GridCoverage2D croppedGridCoverage = BilWCSUtils.crop(coverage,
              (GeneralEnvelope) coverage.getEnvelope(), cvCRS, destinationEnvelopeInSourceCRS,
              Boolean.TRUE);
     
      /**
       * Scale/Resampling (if necessary)
       */
 
View Full Code Here

Examples of org.opengis.coverage.grid.GridCoverage

                // create the coverage
                GridCoverage2D gridCoverage = prepareCoverage(finalRaster, sampleDimensions);

                // Adding coverage domain
                if (gridCoverage != null) {
                    GridCoverage gcResponse = new DefaultGridCoverageResponse(gridCoverage,
                            timeRange, elevation);
                    addResult(gcResponse);
                }
            }
        }
View Full Code Here

Examples of org.opengis.coverage.grid.GridCoverage

    // /////////////////////////////////////////////////////////////////////
    if (!executed) {
      try {
              output=null;
        // executes this node
              final GridCoverage result = execute();
        if (result == null)
          error = new CoverageProcessingException("Something bad occurred while trying to execute this node.");
        if (!(result instanceof GridCoverage2D))
            error = new CoverageProcessingException("Something bad occurred while trying to execute this node.");
        if(error==null)
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.