Hi,
I'm trying to use geotools to extract the metadata from a GeoTiff file:
( I got the tiff file from http://www.gelib.com/ )
below is the code I'm using :
the bad news is that it doesn't work. geotools throws lots of exceptions
Could someone help me with this?
(I need a simple example of how to extract metadata from a GeoTiff file)
thanks in advance.
-----------
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import org.geotools.data.DataSourceException;
import org.geotools.gce.geotiff.GeoTiffReader;
import org.geotools.gce.geotiff.adapters.GeoTiffIIOMetadataDecoder;
public class ExtractInfoFromGeoTiff {
public static void main(String args[]) throws DataSourceException,
FileNotFoundException{
String myImageFile = "b2_A1.tif";
InputStream input = new FileInputStream(myImageFile);
GeoTiffReader a = new GeoTiffReader(input);
GeoTiffIIOMetadataDecoder b = a.getMetadata();
// Geotiff geokeys for geocoding
// http://www.remotesensing.org/geotiff/spec/geotiff2.7.html#2.7.2
int projNatOriginLongGeoKey = 3080;
int projNatOriginLatGeoKey = 3081;
String natOriginLongGeoKey = b.getGeoKey(projNatOriginLongGeoKey);
String natOriginLatGeoKey = b.getGeoKey(projNatOriginLatGeoKey);
}
}
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit. See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users