[geotk] applet to display raster

Ramzi Oueslati geotoolkit.org at oueslati.org
Wed Jan 12 10:54:07 EST 2011


Thanks Martin.

The TIFF static class is not visible (private I guess). I added the
following line instead:
IIORegistry.getDefaultInstance().registerServiceProvider(
                new GeoTiffImageReader.Spi("TIFF"), ImageReaderSpi.class);

And it works fine. There is some kind of refreshing issue (coverage
shows up and then disappears in the very first seconds) but after I
execute some operations like zoom-in and move then the coverage comes
back and finally sticks there. It also works when launching with java
web start (which used to show the same errors as reported in the
earlier posts).

Trying to display a JPEG coverage still throws the "Envelope"
exception but I guess I understand the underlying logic and I will
figure it out.

Thank you so much for your help.

Regards,
Ramzi Oueslati

2011/1/12 Martin Desruisseaux <martin.desruisseaux at geomatys.fr>:
> 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
>
> _______________________________________________
> Geotoolkit mailing list
> Geotoolkit at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/geotoolkit
>


More information about the Geotoolkit mailing list