Re: [JPP-Devel] How to use com.vividsolutions.jump.workbench.imagery.geoimg.GeoRaster

2020-09-08 Thread Giuseppe Aruta
Hi Ede,
thanks for the answer. I found that GeoReferencedRaster is more versatile
to read TIFF than simple JAI. I used this class to modify
TiFFUtils.readImage(..) method, used by Sextante RasterImage framework to
load TIFF.

Peppe

Il giorno dom 6 set 2020 alle ore 16:44  ha scritto:

> On 03.09.2020 09:33, Giuseppe Aruta wrote:
> > Hi Ede,is it possible to use
> > com.vividsolutions.jump.workbench.imagery.geoimg.GeoRaster
> > to read an image file?
> > And how?
>
> same as GeoReferencedRaster
>
> but as
>
>   public class GeoReferencedRaster extends GeoRaster
>
> you don't really gain anything, because GeoRaster is essentially
> GeoReferencedRaster without some fancy geo metadata processing. look at
> it's load routine
>
>   protected void readRasterfile() throws ReferencedImageException {
> super.readRasterfile();
> ...
>
>
> > I can easily use GeoReferencedRaster(File file)
> > but not GeoRaster(File file)
>
> hmm the class seems to be abstract although no methods or members are
> abstract. probably because of that. we can make it public, but as said. it
> merely a base class to create a JAI object to be rendered. the referenced
> (geo data enriched) image will be provided by GeoReferencedRaster.
>
> hope i confused you some more :) ..ede
>
>
> ___
> Jump-pilot-devel mailing list
> Jump-pilot-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>
___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel


[JPP-Devel] [jump-pilot:bugs] #498 Most GeoTIFF drivers fail with a simple GeoTIFF image

2020-09-08 Thread Giuseppe Aruta via Jump-pilot-devel
(Sextante) RasterImage. I had to revert some changes I did in these days. 
Mostly connected to cell query. The reason: Roberto Rossi, from Univ, of Padua, 
who worked as my tester found some blurring on display discrete DEMs (Dem with 
classes) and the cell query was quite slow and displaying wrong info (possibily 
due to a delay on the reading process, the read values were "jumping" from the 
original position to the click point. To summerize with these last modification
a) OJ opens and display both test tiff (small_earth.tif and AsterDEM). In some 
cases, large file, user needs to zoom one or two times to the layer to 
accellerate the display process. If I load several big files and then I load 
AsterDEM, this is not displayed (the reasons? Memory, ImageIO readers?). 
Blurring was solved
b) info tools on the cell finally works well on AsterDEM fine, they don't work 
fine with  small_earth.tif). 
c) in both cases I cannot extract a part of the image (draw fence-extract part 
of image). I didn't explore the reason. AFAIR this tool at the beginning had 
problems when Alberto de Luca changed RasterImage framework.

I think I will stop making changes. Roberto goes on to do few test as his 
course (where he uses OJ)  starts the 1 of October  - to late to move to OJ 
1.16.

The essential change on the Raster Framework

-  OJ 1.15, on decoding TIF file, was using JAI. Actual NB version is using JAI 
Image I/O and takes advance of Ede's class GeoReferencedRaster which iseems to 
be quite versatile (JAI, SUN and Geosolutions ImageIO, GDAL)
- I understood that to display an Image on the view depends on the quantity of 
memory available (see method RasterImageLayer.create(..). BufferedImage 
RasterImageLayer.stretchImageValuesForDisplay() seemed to fail with 
small_earth.tif so I added a try/catch statement on RasterImageLayer.create(..) 
that, in case of stretchImageValuesForDisplay() failure it uses 
getImageForDisplay() for BufferedImage




---

** [bugs:#498] Most GeoTIFF drivers fail with a simple GeoTIFF image**

**Status:** open
**Milestone:** OJ_future
**Created:** Sun Aug 30, 2020 08:02 AM UTC by michael michaud
**Last Updated:** Sun Sep 06, 2020 10:02 PM UTC
**Owner:** nobody
**Attachments:**

- 
[small_world.tif](https://sourceforge.net/p/jump-pilot/bugs/498/attachment/small_world.tif)
 (240.6 kB; image/tiff)


I often have a bad experience trying to read simple geotiff. To have a more 
objective view of the situation, I get a very simple image from the test 
directory of GDAL library and tested it against all our drivers.
Image is attached. Here are its main characteristics (I think they are very 
common one) :
small_world.tif 
size : 400 x 200
Coordinate System : wgs84 (4326)
Metadata : AREA_OR_POINT=AREA
Image Structure Metadata : INTERLEAVE=BAND
3 bands, Block=400x20, Type=Byte, ColorInterp=RGB

I tried to import it with all the image drivers we propose (8 from Open File + 
ImageRaster Sextante). 3 drivers only could import the image. All others fail 
throughing a rough java exception. Image Raster don't fail immediately, but it 
does not display the image and throws NPE if one try to get more information. 

List of success/failures and exceptions thrown

  Referenced Image (ImageIO[ext],JAI) : OK
  ImageIO TIFF Image Reader version 1.0 : OK
  ImageIO TIFF Image Reader version 1.1 : OK
  Standard TIFF Image Reader 
java.lang.IllegalAccessException: class 
com.vividsolutions.jump.workbench.imagery.ImageryLayerDataset cannot access 
class com.sun.imageio.plugins.tiff.TIFFImageReaderSpi (in module java.desktop) 
because module java.desktop does not export com.sun.imageio.plugins.tiff to 
unnamed module @12405818
at 
java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:361)
at 
java.base/jdk.internal.reflect.Reflection.ensureMemberAccess(Reflection.java:99)
at java.base/java.lang.Class.newInstance(Class.java:579)
at 
com.vividsolutions.jump.workbench.imagery.ImageryLayerDataset.createFeatureFactory(ImageryLayerDataset.java:236)
at 
com.vividsolutions.jump.workbench.imagery.ImageryLayerDataset.attachImage(ImageryLayerDataset.java:117)
  Referenced Image (JAI TIF)
java.lang.NullPointerException java.lang.NullPointerException at 
com.sun.media.jai.util.SunCachedTile.(SunCachedTile.java:80) 
at com.sun.media.jai.util.SunTileCache.add(SunTileCache.java:257) 
at javax.media.jai.OpImage.addTileToCache(OpImage.java:1087) 
at javax.media.jai.OpImage.getTile(OpImage.java:1142) 
at javax.media.jai.PlanarImage.getData(PlanarImage.java:2085) 
at 
javax.media.jai.RenderedImageAdapter.getData(RenderedImageAdapter.java:158) 
at javax.media.jai.ScaleOpImage.computeTile(ScaleOpImage.java:1099) 
at 
com.sun.media.jai.util.SunTileScheduler.scheduleTile(SunTileScheduler.java:904) 
at javax.media.jai.OpImage.getTile(OpImage.java:1129) 
at com.sun.media.jai.opimage.CropO