Examples of GridCoverage


Examples of org.opengis.coverage.grid.GridCoverage

    }
   
    @Override
    public void write( IMap map, BufferedImage image, File destination ) throws IOException {
        GeoTiffWriter writer = new GeoTiffWriter(destination);
        GridCoverage coverage = convertToGridCoverage(map.getViewportModel(), image);
        writer.write(coverage, null);
    }
View Full Code Here

Examples of org.opengis.coverage.grid.GridCoverage

        return true;
      }
     
        if (aLayer.hasResource(GridCoverage.class)){
          try{
            GridCoverage gc = aLayer.getResource(GridCoverage.class, null);
            if (gc.getNumSampleDimensions() >= 3){
              return true;
            }else{
              return false;
            }
          }catch (Exception ex){
View Full Code Here

Examples of org.opengis.coverage.grid.GridCoverage

                // set opacity
                opacity.set(sym);

                // channel selection - setup band selection
                Layer l = getLayer();
                GridCoverage gc = null;
                try {
                    gc = (GridCoverage) l.getResource(GridCoverage.class, null);
                    String[] bands = new String[gc.getNumSampleDimensions()];
                    for( int i = 0; i < bands.length; i++ ) {
                        bands[i] = (i + 1) + Messages.SimpleRasterConfigurator_BandDelimiter
                                + gc.getSampleDimension(i).getDescription().toString();
                    }
                    rgbViewer.setBands(bands);
                } catch (Exception ex) {

                }
View Full Code Here

Examples of org.opengis.coverage.grid.GridCoverage

  public final synchronized Object findResource() throws IOException {
    lock.lock();
    try {
      if (this.coverage == null  || this.coverage.get()==null ) {
        try {
          GridCoverage gridCoverage = loadCoverage();
                    this.coverage = new SoftReference<GridCoverage>(gridCoverage);
        } catch (Throwable t) {
          msg = t;
          RasteringsPlugin.log("error reading coverage", t); //$NON-NLS-1$
          return null;
View Full Code Here

Examples of org.opengis.coverage.grid.GridCoverage

    protected GridCoverage loadCoverage() throws IOException {
        AbstractGridCoverage2DReader reader = this.service(new NullProgressMonitor()).getReader(null);
        ParameterGroup pvg = getReadParameters();
        List<GeneralParameterValue> list = pvg.values();
        GeneralParameterValue[] values = list.toArray(new GeneralParameterValue[0]);
        GridCoverage gridCoverage = reader.read(values);
        return gridCoverage;
    }
View Full Code Here

Examples of org.opengis.coverage.grid.GridCoverage

   
    for (IColorMapTypePanel pnl : stylePanels){
      pnl.setFormatter(this.formatter);
    }
    try{
      GridCoverage coverage = l.getGeoResource().resolve(GridCoverage.class, null);
     
      if (coverage.getNumSampleDimensions() > 0){
        formatter.setRawDataType(coverage.getSampleDimension(0).getSampleDimensionType());
        this.noDataValues = coverage.getSampleDimension(0).getNoDataValues();     
      }
    }catch (Exception ex){
      //eat me
    }
    if (colorRules != null){
View Full Code Here

Examples of org.opengis.coverage.grid.GridCoverage

        AffineTransform tempTransform = graphics.getTransform();
        AffineTransform atg = new AffineTransform(tempTransform);
        atg.concatenate(at);
        graphics.setTransform(atg);

        GridCoverage coverage;
        try {
            coverage = getContext().getGeoResource().resolve(GridCoverage.class, null);

            RasterSymbolizer rasterSymbolizer;
View Full Code Here

Examples of org.opengis.coverage.grid.GridCoverage

        AffineTransform tempTransform = graphics.getTransform();
        AffineTransform atg = new AffineTransform(tempTransform);
        atg.concatenate(at);
        graphics.setTransform(atg);

        GridCoverage coverage;
        try {
            coverage = getContext().getGeoResource().resolve(GridCoverage.class, null);

            RasterSymbolizer rasterSymbolizer;
View Full Code Here

Examples of org.opengis.coverage.grid.GridCoverage

      for (Double no : valuesToIgnore){
        ignore.add(new Range<Double>(no));
      }
    }
   
    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);
    }
     
    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;
View Full Code Here

Examples of org.opengis.coverage.grid.GridCoverage

      double[] valuesToIgnore,
      GridCoverageReader layer,
      Long sampleSize,
      IProgressMonitor monitor) throws Exception{
    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;
    HashSet<Double> ignoreset = new HashSet<Double>();
    if (valuesToIgnore != null){
      for (Double d : valuesToIgnore){
        ignoreset.add(d);
      }
    }

    List<Double> data = new ArrayList<Double>(width * height);
    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 ++){
          Double v = df.getElemDouble(i);
          if (!ignoreset.contains(v)){
            data.add(v);
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.