Could I ask you to join the rest of the community on the geotools users list 
:-) While we use codehaus for our wiki and issue tracker we use source forge 
for the various email lists.
- http://geotools.org/getinvolved.html

Jody

On 11/06/2010, at 4:20 PM, lancelot_234 wrote:

> 
> 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);
> }
> } 
> 
> -------------------------
> 
> -- 
> View this message in context: 
> http://old.nabble.com/how-to-extract-data-from-GeoTiff---tp28851659p28851659.html
> Sent from the geotools - dev mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
> 
>    http://xircles.codehaus.org/manage_email
> 
> 


------------------------------------------------------------------------------
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

Reply via email to