[geotk] applet to display raster

Martin Desruisseaux martin.desruisseaux at geomatys.fr
Wed Jan 12 10:08:39 EST 2011


Maybe the image does not contains georeferencing information. It could be the 
case if the Java TIFF image reader has been used instead of the GeoTIFF reader. 
After registering the JAI reader explicitely, we also need to register the 
GeoTIFF reader explicitely:

IIORegistry.getDefaultInstance().registerServiceProvider(new
GeoTIFFImageReader.TIFF(), ImageReaderSpi.class);


We need to do that because the automatic registration of GeoTiffImageReader 
failed since it didn't found the Java TIFF reader at that time.

     Martin



Le 12/01/11 16:00, Ramzi Oueslati a écrit :
> Martin,
>
> Well well. It seems it did the trick. I don't understand why but it
> seems classes are only loaded when explicitly called from the code. I
> will try to find out.
> It still does not work but now I get the same exception as when I try
> to display a JPEG image:
>
> org.opengis.referencing.operation.TransformException: Can't transform envelope.
> 	at org.geotoolkit.referencing.CRS.transform(CRS.java:1456)
> 	at org.geotoolkit.display.primitive.AbstractReferencedGraphic2D.setEnvelope(AbstractReferencedGraphic2D.java:174)
> 	at org.geotoolkit.display2d.container.stateless.AbstractLayerJ2D.<init>(AbstractLayerJ2D.java:70)
> 	at org.geotoolkit.display2d.container.statefull.StatefullCoverageLayerJ2D.<init>(StatefullCoverageLayerJ2D.java:65)
> 	at org.geotoolkit.display2d.container.stateless.StatelessContextJ2D.parseLayer(StatelessContextJ2D.java:127)
> 	at org.geotoolkit.display2d.container.stateless.StatelessContextJ2D.layerChange(StatelessContextJ2D.java:200)
> 	at org.geotoolkit.map.ContextListener$Weak.layerChange(ContextListener.java:100)
> 	at org.geotoolkit.map.DefaultMapContext.fireLayerChange(DefaultMapContext.java:231)
> 	at org.geotoolkit.map.DefaultMapContext$AdapterList.add(DefaultMapContext.java:390)
> 	at org.geotoolkit.map.DefaultMapContext$AdapterList.add(DefaultMapContext.java:360)
> 	at java.util.AbstractList.add(Unknown Source)
> 	at com.spotimage.sdi.applet.OOApplet$1.actionPerformed(OOApplet.java:97)
> 	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
> 	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
> 	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
> 	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
> 	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
> 	at java.awt.Component.processMouseEvent(Unknown Source)
> 	at javax.swing.JComponent.processMouseEvent(Unknown Source)
> 	at java.awt.Component.processEvent(Unknown Source)
> 	at java.awt.Container.processEvent(Unknown Source)
> 	at java.awt.Component.dispatchEventImpl(Unknown Source)
> 	at java.awt.Container.dispatchEventImpl(Unknown Source)
> 	at java.awt.Component.dispatchEvent(Unknown Source)
> 	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
> 	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
> 	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
> 	at java.awt.Container.dispatchEventImpl(Unknown Source)
> 	at java.awt.Component.dispatchEvent(Unknown Source)
> 	at java.awt.EventQueue.dispatchEvent(Unknown Source)
> 	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
> 	at java.awt.EventDispatchThread.pumpEventsForFilter(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.opengis.referencing.operation.OperationNotFoundException:
> No transformation available from system "ImageCRS[Grid]" to
> "GeographicCRS[WGS84(DD)]".
> 	at org.geotoolkit.referencing.operation.DefaultCoordinateOperationFactory.createOperation(DefaultCoordinateOperationFactory.java:339)
> 	at org.geotoolkit.referencing.CRS.transform(CRS.java:1454)
> 	... 35 more
>
> No problem from appletviewer though



More information about the Geotoolkit mailing list