From: gaby <g....@ni...> - 2013-07-24 03:03:19
|
I am reading in a world image PNG, reprojecting it, and writing it out. The process, when I use GridFormatFinder, takes about a minute or so. If I use WorldImageReader, it takes twice as long. In either case, it is unacceptably long. Perhaps I am not setting some parameters correctly? The file is 383KB My code below. try { File rasterFile = new File("TestData/heathcote_max_vel.png"); /* WorldImageFormat format = (WorldImageFormat) GridFormatFinder.findFormat( rasterFile ); AbstractGridCoverage2DReader reader = format.getReader(rasterFile); */ WorldImageReader reader = new WorldImageReader(rasterFile, null); GridCoverage2D myGridCov = reader.read(null); GridCoverage2D reprojected = (GridCoverage2D) Operations.DEFAULT.resample(myGridCov, CRS.decode("EPSG:2193")); WorldImageWriter wiw = new WorldImageWriter(new File("TestData/NZTM/heathcote_max_vel.png")); ParameterValueGroup params = reader.getFormat().getWriteParameters(); params.parameter(WorldImageFormat.FORMAT.getName().toString()).setValue("png"); GeneralParameterValue[] gpv = {params.parameter(WorldImageFormat.FORMAT.getName().toString()) }; wiw.write(reprojected, gpv); wiw.dispose(); } catch (IOException e) { e.printStackTrace(); } catch (CoverageProcessingException e) { e.printStackTrace(); } catch (NoSuchAuthorityCodeException e) { e.printStackTrace(); } catch (FactoryException e) { e.printStackTrace(); } Thanx Gaby -- View this message in context: http://osgeo-org.1560.x6.nabble.com/Why-does-writing-out-a-world-image-takes-minutes-tp5068335.html Sent from the geotools-gt2-users mailing list archive at Nabble.com. |