Hi,
I would like to know why the following "Question" class produces a
/tmp/out.asc file that's different
from
http://geosysin.iict.ch/irstv-trac/browser/datas2tests/grid/sample.asc?format=rawwhereas
I expected them to be identical (it's not just a question of NODATA_value
conversion from int to
float and \r\n to \n EOL tags).
I thought "ArcGridReader -> GeoTiffWriter -> GeoTiffReader -> ArcGridWriter"
wouldn't modify
my data.
Many thanks for your help,

package gridCoverage;

import java.io.File;
import java.io.IOException;
import java.net.URL;

import org.geotools.coverage.grid.GridCoverage2D;
import org.geotools.gce.arcgrid.ArcGridReader;
import org.geotools.gce.arcgrid.ArcGridWriter;
import org.geotools.gce.geotiff.GeoTiffReader;
import org.geotools.gce.geotiff.GeoTiffWriter;

public class Question {

   public static void main(String[] args) throws IOException {
       URL arcURL = new URL("
http://geosysin.iict.ch/irstv-trac/browser/datas2tests/grid/sample.asc?format=raw";);


       ArcGridReader agr = new ArcGridReader(arcURL);
       GridCoverage2D gcin = (GridCoverage2D) agr.read(null);
       gcin.geophysics(true);
       // gcin.show("1st display (.asc)");

       // asc2tif
       File out = new File("/tmp/out.tif");
       if (out.exists())
           out.delete();
       GeoTiffWriter gtw = new GeoTiffWriter(out);
       gtw.write(gcin, null);

       GeoTiffReader gtr = new GeoTiffReader(out);
       GridCoverage2D gcout = (GridCoverage2D) gtr.read(null);
       gcout.geophysics(true);
       // gcout.show("2nd display (.asc -> .tif -> .asc)");

       // tif2asc
       File outasc = new File("/tmp/out.asc");
       if (outasc.exists())
           outasc.delete();
       ArcGridWriter toto = new ArcGridWriter(outasc);
       toto.write(gcout, null);
   }
}

--
Thomas LEDUC
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to