Hi,

With help from people on the list I have successfully been able to read in a 
grid coverage from an asc file with an associated prj file. What I want to do 
now, though, is to read in the coverage from a stream. The problem I am having 
is that I can't figure out how to set the crs now that geotools can no longer 
look for a prj file.

The code I have is somewhat like this:

ArcGridFormat format = new ArcGridFormatFactory().createFormat();
InputStream is = new ByteArrayInputStream(ascStringData.getBytes());
AbstractGridCoverage2DReader reader = format.getReader(is);
GridCoverage2D coverage2D = reader.read(null);


I have been looking through the API and source for the relevant classes and 
have found this text in the ArcGridReader class for when the data is read from 
a stream rather than a file:

"I ask the user who's invoking the read operation to provide me a valid crs and 
envelope through read parameters."

But I've been going round in circles a bit trying to work out how to do this. 
The problem I am having is:

1. How do I create a CoordinateReferenceSystem object for my coverage as 
presumably this is what I need to pass in the reader.read() method (I'm using 
BNG)

2. How do I actually tell the reader to use the CRS? I can see that the 
reader.read() method can take a list of GeneralParameterValue objects, but I 
can't work out how to wrap a CRS in a GeneralParameterValue (or if this is 
necessary in the first place).

Thanks in advance for the help,
Nick
------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to