Ciao Gary,
I downloaded you geotiff and I simply opened it up in a simple test app I built some time ago using MapPane. It seems to woek just fine but there are a couple of things to say:

1>I have attached a java file with my stupid sample app. You need to put all the needed jars in the classpath, main, referencing, coverage, geotiff, image, etc...
I usually start it this way:
program arguments:  path=ath_to_my_geotiff
VM arguments: -Xmx200M -Dorg.geotools.test.geotiff=true

if yu set -Dorg.geotools.test.geotiff=false the test ap will try to force to open the image as a world image which will fail in your case since no prj was is present, otherwise the app will use the geotiff will use the geotiff reader and everyting will be fine.

2>Your tiff fis an indexed tiff hence it won't work on 2.3.0. I have added support for images with palette at the beginning of Jan, after 2.3.0 was release. You can download a snapshot of 2.3.1 here http://www.geo-solutions.it/gt2_nightly/ along with the relevant source code. This is the version I am using

3>In case you want to open the image as a world file, please provide a prj file.

4>Performances are good, but if you want more you need to add overviews to you geotiff and also to tile it.

Let me know how it goes.

Simone.
-------------------------------------------------------
Eng. Simone Giannecchini

President/CEO GeoSolutions
http://www.geo-solutions.it
Via Carignoni 51
550141 Camaiore (LU)
Italy
Mobile: +39 333 81 28928
-------------------------------------------------------
----- Original Message ----- From: "Gary Lucas" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, February 28, 2007 4:32 PM
Subject: [Geotools-gt2-users] Problem plotting GeoTiff image


I am back to working with GeoTools after several months away due to commitments to other projects. When I left off on my GeoTools work (rather reluctantly I might add, since it GeoTools is pretty interesting stuff), I was stuck on a problem with GeoTiff files and hoping that it would be fixed by the then new release 2.3.0 Unfortunately, I'm now using 2.3.0, I'm still having no luck, and am beginning to think that there is a bug in the GeoTiff implementation.

Basically, I took the MapViewer.java demo and added some lines of code (shown below) as a the "loadTiff" method to attempt to add the GeoTiff to the MapViewer picture (loadTiff is called after the existing MapViewer "load" method). This code has worked for some other GeoTiff products, but is still not working for the GeoTiff in which I am most interested. When I run the MapViewer demo, I often get ProjectionExceptions and IllegalArgumentExceptions. Some of them appear to relate to the proximity of the map to the North Pole (I am using a global scale Shape file). But even when I zoom in to the area of interest for the GeoTiff, GeoTools doesn't always throw an exception but still declines to produce an image

The GeoTiff is in a Lambert Conic Conformal projection, but the MapViewer is set to use good old CRS "EPSG:4326"

Can anyone offer me guidance?

Gary

-----------------------------------------------------------------
Using GeoTools 2.3.0
The source data for the GeoTiffs is available at
http://avn.faa.gov/index.asp?xml=naco/catalog/charts/digital/Raster_Sectional_Sample/Raster


-----------------------------------------------------------------
The code added to the "loadFiff" method is
File tiffFile = new File("C:/Downloads/FaaSectionalMap/sample.tif");
   AbstractGridCoverage2DReader rdr = new GeoTiffReader(tiffFile);
   CoordinateReferenceSystem crs = rdr.getCrs();
ReferencedEnvelope dataEnvelope = new ReferencedEnvelope(rdr.getOriginalEnvelope(), crs);

   StyleBuilder               sb       = new StyleBuilder();
       RasterSymbolizer           rsDem    = sb.createRasterSymbolizer();
   org.geotools.styling.Style demStyle = sb.createStyle(rsDem);
       MapContext context = mp.getContext();
       context.addLayer(rdr, demStyle);


---------------------------------------------------------------------
The exceptions are

WARNING: Unable to get the resolution
org.geotools.data.DataSourceException: Unable to get the resolution
at org.geotools.data.coverage.grid.AbstractGridCoverage2DReader.getResolution(AbstractGridCoverage2DReader.java:587) at org.geotools.data.coverage.grid.AbstractGridCoverage2DReader.setReadParams(AbstractGridCoverage2DReader.java:228)
at org.geotools.gce.geotiff.GeoTiffReader.read(GeoTiffReader.java:376)
at org.geotools.renderer.lite.StreamingRenderer.renderRaster(StreamingRenderer.java:1792) at org.geotools.renderer.lite.StreamingRenderer.processSymbolizers(StreamingRenderer.java:1586) at org.geotools.renderer.lite.StreamingRenderer.process(StreamingRenderer.java:1530) at org.geotools.renderer.lite.StreamingRenderer.processStylers(StreamingRenderer.java:1472) at org.geotools.renderer.lite.StreamingRenderer.paint(StreamingRenderer.java:543) at org.geotools.renderer.lite.StreamingRenderer.paint(StreamingRenderer.java:406)
at com.sonalysts.gui.swing.JMapPane.paintComponent(JMapPane.java:414)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintWithOffscreenBuffer(Unknown Source)
at javax.swing.JComponent.paintDoubleBuffered(Unknown Source)
at javax.swing.JComponent._paintImmediately(Unknown Source)
at javax.swing.JComponent.paintImmediately(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: org.geotools.referencing.operation.projection.ProjectionException: Latitude 90°00.0'S is too close to a pole. at org.geotools.referencing.operation.projection.LambertConformal.transformNormalized(LambertConformal.java:215) at org.geotools.referencing.operation.projection.MapProjection.transform(MapProjection.java:636) at org.geotools.referencing.operation.projection.MapProjection.transform(MapProjection.java:677) at org.geotools.referencing.operation.transform.AbstractMathTransform.transform(AbstractMathTransform.java:235) at org.geotools.referencing.operation.transform.ConcatenatedTransformDirect.transform(ConcatenatedTransformDirect.java:68)
at org.geotools.resources.CRSUtilities.transform(CRSUtilities.java:531)
at org.geotools.data.coverage.grid.AbstractGridCoverage2DReader.getResolution(AbstractGridCoverage2DReader.java:579)

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


Feb 28, 2007 9:37:22 AM org.geotools.renderer.lite.StreamingRenderer renderRaster WARNING: The number of image bands (3) differs from the number of supplied 'SampleDimension' objects (1). java.lang.IllegalArgumentException: The number of image bands (3) differs from the number of supplied 'SampleDimension' objects (1). at org.geotools.coverage.grid.Grid2DSampleDimension.create(Grid2DSampleDimension.java:118)
at org.geotools.coverage.grid.GridCoverage2D.<init>(GridCoverage2D.java:271)
at org.geotools.coverage.processing.operation.ScaledGridCoverage2D.<init>(ScaledGridCoverage2D.java:180) at org.geotools.coverage.processing.operation.ScaledGridCoverage2D.create(ScaledGridCoverage2D.java:172) at org.geotools.coverage.processing.operation.Scale.doOperation(Scale.java:158) at org.geotools.renderer.lite.gridcoverage2d.GridCoverageRenderer.scale(GridCoverageRenderer.java:736) at org.geotools.renderer.lite.gridcoverage2d.GridCoverageRenderer.paint(GridCoverageRenderer.java:482) at org.geotools.renderer.lite.StreamingRenderer.renderRaster(StreamingRenderer.java:1795) at org.geotools.renderer.lite.StreamingRenderer.processSymbolizers(StreamingRenderer.java:1586) at org.geotools.renderer.lite.StreamingRenderer.process(StreamingRenderer.java:1530) at org.geotools.renderer.lite.StreamingRenderer.processStylers(StreamingRenderer.java:1472) at org.geotools.renderer.lite.StreamingRenderer.paint(StreamingRenderer.java:543) at org.geotools.renderer.lite.StreamingRenderer.paint(StreamingRenderer.java:406)
at com.sonalysts.gui.swing.JMapPane.paintComponent(JMapPane.java:414)
at javax.swing.JComponent.paint(Unknown Source)




---
Gary W. Lucas, Senior Software Engineer
Sonalysts, Inc
215 Parkway North
Waterford, CT 06320
(860) 326-3682

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Attachment: TestTiffs.java
Description: Binary data

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to