Ciao Cesar,
best thing would be if you could provide some sample data to me.
Which version of geotools are you using?

Simone.

-------------------------------------------------------
Ing. Simone Giannecchini
GeoSolutions S.A.S.
Founder - Software Engineer
Via Carignoni 51
55041  Camaiore (LU)
Italy

phone: +39 0584983027
fax:      +39 0584983027
mob:    +39 333 8128928


http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://simboss.blogspot.com/
http://www.linkedin.com/in/simonegiannecchini

-------------------------------------------------------



2009/9/3 César Martínez Izquierdo <cesar....@gmail.com>:
> Hello,
>
> I'm trying to read some (Geo)Tiff files with GeoTools, but I get an
> error. My code is simple:
>
>
> File file = new File("C:\\test\\recorte_lceugr.tif");
> GeoTiffFormat gtf = new GeoTiffFormat();
> GridCoverageReader reader = gtf.getReader(file);
>
>
> But I get an exception in the third line.
> If the TIFF was generated with gvSIG, I get the following exception:
>
> java.lang.IllegalArgumentException: GeoKey directory does not exist
>        at 
> org.geotools.gce.geotiff.IIOMetadataAdpaters.GeoTiffIIOMetadataDecoder.<init>(GeoTiffIIOMetadataDecoder.java:124)
>        at 
> org.geotools.gce.geotiff.GeoTiffReader.getHRInfo(GeoTiffReader.java:278)
>        at 
> org.geotools.gce.geotiff.GeoTiffReader.<init>(GeoTiffReader.java:222)
>        at 
> org.geotools.gce.geotiff.GeoTiffFormat.getReader(GeoTiffFormat.java:253)
>        at 
> org.geotools.gce.geotiff.GeoTiffFormat.getReader(GeoTiffFormat.java:213)
>        at etclusi.tests.gt.TestGeoTiff.main(TestGeoTiff.java:24)
>
> If the TIFF was generated with ArcGIS, then I get:
> 03-sep-2009 16:51:16
> org.geotools.gce.geotiff.crs_adapters.GeoTiffMetadata2CRSAdapter
> getGeoKeyAsInt
> ADVERTENCIA: null
> java.lang.NumberFormatException: null
>        at java.lang.Integer.parseInt(Integer.java:415)
>        at java.lang.Integer.parseInt(Integer.java:497)
>        at 
> org.geotools.gce.geotiff.crs_adapters.GeoTiffMetadata2CRSAdapter.getGeoKeyAsInt(GeoTiffMetadata2CRSAdapter.java:452)
>        at 
> org.geotools.gce.geotiff.crs_adapters.GeoTiffMetadata2CRSAdapter.createCoordinateSystem(GeoTiffMetadata2CRSAdapter.java:235)
>        at 
> org.geotools.gce.geotiff.GeoTiffReader.getHRInfo(GeoTiffReader.java:294)
>        at 
> org.geotools.gce.geotiff.GeoTiffReader.<init>(GeoTiffReader.java:222)
>        at 
> org.geotools.gce.geotiff.GeoTiffFormat.getReader(GeoTiffFormat.java:253)
>        at 
> org.geotools.gce.geotiff.GeoTiffFormat.getReader(GeoTiffFormat.java:213)
>        at etclusi.tests.gt.TestGeoTiff.main(TestGeoTiff.java:24)
> Exception in thread "main" java.lang.UnsupportedOperationException:
> GeoTiffMetadata2CRSAdapter::createCoordinateSystem:Only Geographic &
> Projected Systems are supported.
>        at 
> org.geotools.gce.geotiff.crs_adapters.GeoTiffMetadata2CRSAdapter.createCoordinateSystem(GeoTiffMetadata2CRSAdapter.java:243)
>        at 
> org.geotools.gce.geotiff.GeoTiffReader.getHRInfo(GeoTiffReader.java:294)
>        at 
> org.geotools.gce.geotiff.GeoTiffReader.<init>(GeoTiffReader.java:222)
>        at 
> org.geotools.gce.geotiff.GeoTiffFormat.getReader(GeoTiffFormat.java:253)
>        at 
> org.geotools.gce.geotiff.GeoTiffFormat.getReader(GeoTiffFormat.java:213)
>        at etclusi.tests.gt.TestGeoTiff.main(TestGeoTiff.java:24)
>
> In this second case (ArcGIS), the problem might be that they are not
> real GeoTiff files, as pointed by Niels Hoffmann in [1]. I'm not an
> expert on the topic, so I can't be sure.
>
> Anyway, I am able to read these TIFFs with uDig 1.1.1, so I guess that
> GeoTools is able to read them, and then the problem should be in my
> code or my runtime configuration.
>
> Any idea?
>
>
> Best Regards,
>
>
>
> [1] http://52north.org/pipermail/geoprocessingservices/2009-July/000445.html
>
>
> --
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>   César Martínez Izquierdo
>   GIS developer
>   -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -
>   ETC-LUSI: http://etc-lusi.eionet.europa.eu/
>   Universitat Autònoma de Barcelona (SPAIN)
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Geotools-gt2-users mailing list
> Geotools-gt2-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Geotools-gt2-users mailing list
Geotools-gt2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to