コード例 #1
0
  public void testRasterReaderResOnly() throws Exception {
    double[][] mapData1 =
        new double[][] { //
          {NaN, 850.0, 900.0, 1200.0, 1500.0}, //
          {410.0, 700.0, 800.0, 490.0, 1500.0}, //
          {600.0, 750.0, 770.0, 1000.0, 1500.0}, //
          {910.0, 1001.0, 1200.0, 1300.0, 1500.0} //
        };
    double[][] mapData2 =
        new double[][] { //
          {800.0, 1000.0, 1200.0, 1300.0, 1450.0}, //
          {500.0, 700.0, 800.0, 900.0, 1100.0}, //
          {450.0, 430.0, 600.0, 800.0, 450.0}, //
          {600.0, 750.0, 780.0, 1000.0, 1250.0} //
        };

    double xres = 60.0;
    double yres = 60.0;
    OmsRasterReader reader = new OmsRasterReader();
    reader.pXres = xres;
    reader.pYres = yres;
    reader.file = arcPath;
    reader.process();
    GridCoverage2D readCoverage = reader.outRaster;
    checkMatrixEqual(readCoverage.getRenderedImage(), mapData1);

    reader = new OmsRasterReader();
    reader.pXres = xres;
    reader.pYres = yres;
    reader.file = grassPath;
    reader.process();
    readCoverage = reader.outRaster;
    checkMatrixEqual(readCoverage.getRenderedImage(), mapData2);
  }
コード例 #2
0
  public void testRasterReaderBoundsOnly() throws Exception {
    double[][] mapData =
        new double[][] { //
          {1000, 1000, 1200, 1250, 1300, 1350, 1450}, //
          {750, 850, 860, 900, 1000, 1200, 1250}, //
          {700, 750, 800, 850, 900, 1000, 1100}, //
          {650, 700, 750, 800, 850, 490, 450}, //
          {430, 500, 600, 700, 800, 500, 450}, //
          {700, 750, 760, 770, 850, 1000, 1150} //
        };

    double n = 5140020.0;
    double s = 5139840.0;
    double w = 1640710.0;
    double e = 1640920.0;
    double xres = 30.0;
    double yres = 30.0;
    OmsRasterReader reader = new OmsRasterReader();
    reader.file = arcPath;
    reader.pNorth = n;
    reader.pSouth = s;
    reader.pWest = w;
    reader.pEast = e;
    reader.pXres = xres;
    reader.pYres = yres;
    reader.process();
    GridCoverage2D readCoverage = reader.outRaster;
    checkMatrixEqual(readCoverage.getRenderedImage(), mapData);

    reader = new OmsRasterReader();
    reader.file = grassPath;
    reader.pNorth = n;
    reader.pSouth = s;
    reader.pWest = w;
    reader.pEast = e;
    reader.pXres = xres;
    reader.pYres = yres;
    reader.process();
    readCoverage = reader.outRaster;

    checkMatrixEqual(readCoverage.getRenderedImage(), mapData);
  }