Ciao Thomas,
I (very quickly) tested your test-case, and I have a first question. This data
set seems to be in a rojected coordinate reference system but you are not
supplying any prj file since your are pulling it from the web. This can cause
some griefs
since as of now <ArcGridReader is assuming WGS84 if no CRS is provided.
The question is, which is the correct CRS?
Simone.
-------------------------------------------------------
Eng. Simone Giannecchini
President/CEO GeoSolutions
http://www.geo-solutions.it
Via Carignoni 51
550141 Camaiore (LU)
Italy
Mobile: +39 333 81 28928
-------------------------------------------------------
----- Original Message -----
From: Thomas Leduc
To: [email protected]
Sent: Wednesday, February 28, 2007 7:56 PM
Subject: [Geotools-gt2-users] ArcGridReader, GeoTiffWriter,
GeoTiffReader,ArcGridWriter
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=raw
whereas
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
-------------------------------------------------------------------------
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