Skip to content

Commit

Permalink
Merge pull request #1388 from dvntucker/geot_5556
Browse files Browse the repository at this point in the history
[GEOT-5556] Add mosaic config to config map when updating mosaic
  • Loading branch information
dromagnoli committed Nov 23, 2016
2 parents 7c24282 + 78e67ad commit 12175f3
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
Expand Up @@ -1292,6 +1292,7 @@ public void updateConfiguration(GridCoverage2DReader coverageReader,
// Get the manager for this coverage so it can be updated
rasterManager = getParentReader().getRasterManager(targetCoverageName);
mosaicConfiguration = rasterManager.getConfiguration();
this.configurations.put(mosaicConfiguration.getName(), mosaicConfiguration);
}

// STEP 2
Expand Down
Expand Up @@ -111,7 +111,7 @@ public boolean accept(GranuleDescriptor granuleDescriptor) {
this.currentSubmosaicProducer = new CRSBoundMosaicProducer(
rasterLayerResponse,
dryRun,
currentCRS, granuleDescriptor);
granuleDescriptor.getGranuleEnvelope().getCoordinateReferenceSystem(), granuleDescriptor);
perMosaicProducers.add(currentSubmosaicProducer);
accepted = currentSubmosaicProducer.acceptGranule(granuleDescriptor);
}
Expand Down
Expand Up @@ -19,16 +19,19 @@

import java.awt.image.RenderedImage;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;

import javax.imageio.ImageIO;
import javax.media.jai.Interpolation;

import org.apache.commons.io.FileUtils;
import org.geotools.TestData;
import org.geotools.coverage.grid.GridCoverage2D;
import org.geotools.coverage.grid.io.AbstractGridFormat;
import org.geotools.factory.Hints;
Expand Down Expand Up @@ -70,6 +73,30 @@ public void testWithInterpolation() throws IOException, URISyntaxException {
testMosaic("diff_crs_sorting_test", "resolution D, crs A", null, "EPSG:32610", interpolationParam);
}

@Test
public void testUpdatingMosaic() throws IOException, URISyntaxException {
File second = TestData.file(this, "heterogeneous_crs/zblue.tiff");
File indexer = TestData.file(this, "heterogeneous_crs/indexer.properties");
File first = TestData.file(this, "heterogeneous_crs/red.tiff");
File resultsImage = TestData.file(this, "red_blue_results/red_blue_update_test.tiff");

File testStoreDirectory = crsMosaicFolder.newFolder("updateTest");

FileUtils.copyFile(first, new File(testStoreDirectory, first.getName()));
FileUtils.copyFile(indexer, new File(testStoreDirectory, indexer.getName()));

ImageMosaicReader reader = new ImageMosaicReader(testStoreDirectory);
File sfdemDest = new File(testStoreDirectory, second.getName());
FileUtils.copyFile(second, sfdemDest);

reader.harvest(null, sfdemDest, null);

GridCoverage2D gc2d = reader.read(new GeneralParameterValue[0]);

RenderedImage renderImage = gc2d.getRenderedImage();
ImageAssert.assertEquals(resultsImage, renderImage, 1000);
}

private void testMosaic(String testLocation, String sortOrder, String resultLocation,

String expectedCRS, GeneralParameterValue... params)
Expand Down
Binary file not shown.

0 comments on commit 12175f3

Please sign in to comment.