Hello Rangamani

Do you want to read the geotiff from disk as a file or via a get request from the geoserver?
If the first, you may compare your code with the following:

import java.io.File;
import org.geotools.gce.geotiff.*;
import org.geotools.coverage.grid.GridCoverage2D;

public class GeoTIFFReader {

public static void main(String[] args) {
   File inputFile = new File(String path);
   GeoTiffFormat gtf = new GeoTiffFormat();
   GeoTiffReader gtr = (GeoTiffReader) gtf.getReader(inputFile);
   GridCoverage2D gc = null;

   try {
      gc = (GridCoverage2D) gtr.read(null);
      System.out.println("GeoTIFF successfully loaded.");
      gc.show("TestTIFF");
   }
   catch (Exception e) {
      System.out.println("ERROR: Could not load GeoTIFF.");
   }
}
}

It works for me, after I imported a bunch of jars into my project. You also should try another geotiff, only to make sure your sample tiff is not anyhow corrupt.

If you want to read a geotiff from the geoserver...that's what I'm struggling with right now.

Christian


Am 23.04.2008 um 23:31 schrieb Srikrishnan, Rangamani:
Hi,
  I have used the "sample.tiff" data file which was available from the
geoserver tutorial. I could get the raster image displayed by the geoServer but
I could not do so using my program code.

  I would welcome any help with this problem.

Thanks!

Rangamani
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Geotools-gt2-users mailing list
Geotools-gt2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to