GeoTiff writer will fail for any custom EPSG code
-------------------------------------------------

                 Key: GEOT-3366
                 URL: http://jira.codehaus.org/browse/GEOT-3366
             Project: GeoTools
          Issue Type: Bug
    Affects Versions: 2.7-M5
            Reporter: Andrea Aime
            Assignee: Simone Giannecchini
             Fix For: 2.7-beta1


Trying to encode a raster whose projection is, for example, EPSG:900913, will 
fail with the following stack trace:

{code}
java.lang.IllegalArgumentException: offset is not a TIFF USHORT
        at 
org.geotools.coverage.grid.io.imageio.geotiff.GeoTiffIIOMetadataEncoder.addGeoKeyEntry(GeoTiffIIOMetadataEncoder.java:298)
        at 
org.geotools.coverage.grid.io.imageio.geotiff.GeoTiffIIOMetadataEncoder.addGeoShortParam(GeoTiffIIOMetadataEncoder.java:262)
        at 
org.geotools.coverage.grid.io.imageio.geotiff.CRS2GeoTiffMetadataAdapter.parseProjCRS(CRS2GeoTiffMetadataAdapter.java:232)
        at 
org.geotools.coverage.grid.io.imageio.geotiff.CRS2GeoTiffMetadataAdapter.parseCoordinateReferenceSystem(CRS2GeoTiffMetadataAdapter.java:181)
        at org.geotools.gce.geotiff.GeoTiffWriter.write(GeoTiffWriter.java:219)
        at 
org.vfny.geoserver.wcs.responses.coverage.GeoTIFFCoverageResponseDelegate.encode(GeoTIFFCoverageResponseDelegate.java:110)
{code}

This is happening because the EPSG code returned is not a short. The code is 
likely to be fixed by checking if the code is actually a short:

{code}
final int code = getEPSGCode(projectedCRS);
                if (code != -1 && code <= Short.MAX_VALUE) {
                        
metadata.addGeoShortParam(GeoTiffPCSCodes.ProjectedCSTypeGeoKey,
                                        code);
                        return;
                }
{code}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to