Problem with local maven repository and JGTModel progress monitor

80 views
Skip to first unread message

Marco Foi

unread,
Jul 25, 2013, 3:07:07 PM7/25/13
to jgras...@googlegroups.com
A couple of error occurred in my very first Unit Test on my original code

1) first one is quite strange as did not occur yesterday when for the first time I could have everything set up nicely and made a debug run of a Unit Test.
Here the error:

Jul 25, 2013 8:56:00 PM it.geosolutions.imageio.gdalframework.GDALUtilities loadGDAL
WARNING: Failed to load the GDAL native libs. This is not a problem unless you need to use the GDAL plugins: they won't be enabled.
java.lang.UnsatisfiedLinkError: no gdaljni in java.library.path
Error while parsing JAI registry file "file:/C:/Users/mcfoi/.m2/repository/org/jaitools/jt-all/1.3.0/jt-all-1.3.0.jar!/META-INF/registryFile.jai" :
Error in registry file at line number #59
A descriptor is already registered against the name "VectorBinarize" under registry mode "rendered"

In the time between my first successful debug run and the one giving this issue I deleted my .m2 repo and rebuild the whole with a "mvn install" launched in the source code clone dir. Can be this related to the "duplication" in the registry??

2) In running tests in debug the following line seem to lock everything

pm.beginTask(msg.message("soilthickness.calculating"), rows);

Is this something related to updating the UI??

Thanks

Marco

andrea antonello

unread,
Jul 26, 2013, 4:32:42 AM7/26/13
to jgras...@googlegroups.com
Hi Marco,

> A couple of error occurred in my very first Unit Test on my original code
>
> 1) first one is quite strange as did not occur yesterday when for the first
> time I could have everything set up nicely and made a debug run of a Unit
> Test.
> Here the error:
>
> Jul 25, 2013 8:56:00 PM it.geosolutions.imageio.gdalframework.GDALUtilities
> loadGDAL
> WARNING: Failed to load the GDAL native libs. This is not a problem unless
> you need to use the GDAL plugins: they won't be enabled.
> java.lang.UnsatisfiedLinkError: no gdaljni in java.library.path
> Error while parsing JAI registry file
> "file:/C:/Users/mcfoi/.m2/repository/org/jaitools/jt-all/1.3.0/jt-all-1.3.0.jar!/META-INF/registryFile.jai"
> :
> Error in registry file at line number #59
> A descriptor is already registered against the name "VectorBinarize" under
> registry mode "rendered"
>
> In the time between my first successful debug run and the one giving this
> issue I deleted my .m2 repo and rebuild the whole with a "mvn install"
> launched in the source code clone dir. Can be this related to the
> "duplication" in the registry??

That one is an upstream error and doesn't impact the execution of the
model. Recently in an analysis dependency for udig I noticed that this
is due to the fact that the jaitools project has duplicated jars.
There are all the jars for the single project + the jt-all jar.
Therefore the descriptor gets registered twice.
In the past I excluded the small jars with some maven directive, but
it looks as if something is back. Will have to check when I have time.


> 2) In running tests in debug the following line seem to lock everything
>
> pm.beginTask(msg.message("soilthickness.calculating"), rows);
>
> Is this something related to updating the UI??

Nope, in headless mode this simply gives a sysout print, so it can't
lock anything (or at least it should not).

What do you mena by lock?

Andrea


>
> Thanks
>
> Marco
>
> --
> You received this message because you are subscribed to the Google Groups
> "jgrasstools" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jgrasstools...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Marco Foi

unread,
Aug 13, 2013, 6:39:31 AM8/13/13
to jgras...@googlegroups.com
Forget about this: at the time of this question I had not taken the time to study your code about the Progress Monitor
Now I've set up a new wiky page with some hints (still not linked to the main TOC).


Marco

andrea antonello

unread,
Aug 13, 2013, 6:46:53 AM8/13/13
to jgras...@googlegroups.com
> Forget about this: at the time of this question I had not taken the time to
> study your code about the Progress Monitor
> Now I've set up a new wiky page with some hints (still not linked to the
> main TOC).
>
> https://code.google.com/p/jgrasstools/wiki/ProgressMonitor

Very nice indeed! Thanks.

One minor: pm.beginTask("Start of slope calculation..."), nRasterCols);
There is one bracket in surplus. If you happen to edit it again...

Cheers,
Andrea

Marco Foi

unread,
Aug 13, 2013, 9:32:09 AM8/13/13
to jgras...@googlegroups.com
Done!

-mf


2013/8/13 andrea antonello <andrea.a...@gmail.com>

Feras Obeidat

unread,
Oct 16, 2014, 4:06:29 PM10/16/14
to jgras...@googlegroups.com
Hi everyone,

While running TestHillshade, I got this:
Error while parsing JAI registry file "file:/C:/Users/IBM_ADMIN/.m2/repository/org/jaitools/jt-all/1.3.0/jt-all-1.3.0.jar!/META-INF/registryFile.jai" :
Error in registry file at line number #59
A descriptor is already registered against the name "VectorBinarize" under registry mode "rendered"
working on hillshade
10%... 20%... 30%... 40%... 50%... 60%... Finished.

Is that good or there is an error ?

Thanks in advance!
Feras

andrea antonello

unread,
Oct 17, 2014, 8:09:14 AM10/17/14
to jgras...@googlegroups.com
Hi Feras,

> While running TestHillshade, I got this:
> Error while parsing JAI registry file
> "file:/C:/Users/IBM_ADMIN/.m2/repository/org/jaitools/jt-all/1.3.0/jt-all-1.3.0.jar!/META-INF/registryFile.jai"
> :
> Error in registry file at line number #59
> A descriptor is already registered against the name "VectorBinarize" under
> registry mode "rendered"
> working on hillshade
> 10%... 20%... 30%... 40%... 50%... 60%... Finished.
>
> Is that good or there is an error ?

it is good.

Well, the error message you see comes from one of the underlying
libraries, which didn't cleanup its log system.

But the module seems to end and produce the output.
Didn't it?

Cheers,
Andrea

Feras Obeidat

unread,
Oct 17, 2014, 9:48:28 AM10/17/14
to jgras...@googlegroups.com
Thanks Andrea, however, where can I see the output. Also, is it possible to see the image output. e.g., shapes of mountains after returning the rendered image ?
Many thanks
Feras

andrea antonello

unread,
Oct 17, 2014, 9:57:23 AM10/17/14
to jgras...@googlegroups.com
Hi Feras,

> Thanks Andrea, however, where can I see the output. Also, is it possible to
> see the image output. e.g., shapes of mountains after returning the rendered
> image ?


I only now realized that you were running it from the testcase code
and not from the spatial toolbox.

Well, in that case you will have to read the input raster first and
write the output raster afterwards.

Somthing like:

GridCoverage2D elevationCoverage = OmsRasterReader.readRaster(yourPath);
----------------------------------8<-----------------------------------------
// this comes from the testcase
OmsHillshade hillshade = new OmsHillshade();
hillshade.inElev = elevationCoverage;
hillshade.pElev = 45.0;
hillshade.pAzimuth = 315;

hillshade.pm = pm;

hillshade.process();

GridCoverage2D hillshadeCoverage = hillshade.outHill;
----------------------------------8<-----------------------------------------
OmsRasterWriter.writeRaster("yourOutPath", hillshadeCoverage);

Andrea


> Many thanks
> Feras
>
>
> On Friday, October 17, 2014 8:09:14 AM UTC-4, moovida wrote:
>>
>> Hi Feras,
>>
>> > While running TestHillshade, I got this:
>> > Error while parsing JAI registry file
>> >
>> > "file:/C:/Users/IBM_ADMIN/.m2/repository/org/jaitools/jt-all/1.3.0/jt-all-1.3.0.jar!/META-INF/registryFile.jai"
>> > :
>> > Error in registry file at line number #59
>> > A descriptor is already registered against the name "VectorBinarize"
>> > under
>> > registry mode "rendered"
>> > working on hillshade
>> > 10%... 20%... 30%... 40%... 50%... 60%... Finished.
>> >
>> > Is that good or there is an error ?
>>
>> it is good.
>>
>> Well, the error message you see comes from one of the underlying
>> libraries, which didn't cleanup its log system.
>>
>> But the module seems to end and produce the output.
>> Didn't it?
>>
>> Cheers,
>> Andrea
>
> --
> You received this message because you are subscribed to the Google Groups
> "jgrasstools" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jgrasstools...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Feras Obeidat

unread,
Oct 19, 2014, 1:56:16 PM10/19/14
to jgras...@googlegroups.com
Hello Andrea,

Thank you for your comment, I now wrote the code as follows:

public class HillshadeTesting {

private static IJGTProgressMonitor pm = new LogProgressMonitor();

public static void main(String[] args) throws Exception {
    String inputPath = "C:\\localdata\\sunimage_wgs84.tif";
   String outPutPath = "C:\\localdata\\";
 GridCoverage2D elevationCoverage = OmsRasterReader.readRaster(inputPath);

 OmsHillshade hillshade = new OmsHillshade(); 
         hillshade.inElev = elevationCoverage; 
         hillshade.pElev = 45.0; 
         hillshade.pAzimuth = 315; 
 hillshade.pm = pm;

 hillshade.process();
 GridCoverage2D hillshadeCoverage = hillshade.outHill;
OmsRasterWriter.writeRaster(outPutPath, hillshadeCoverage);

}
}

When I run it, I get this error:

Reading coverage: sunimaqe_wgs84.tif
Oct 19, 2014 1:49:09 PM it.geosolutions.imageio.gdalframework.GDALUtilities loadGDAL
WARNING: Failed to load the GDAL native libs. This is not a problem unless you need to use the GDAL plugins: they won't be enabled.
java.lang.UnsatisfiedLinkError: no gdaljni in java.library.path
Finished.
Exception in thread "main" java.lang.IllegalArgumentException: No input stream for the provided source
at org.geotools.gce.geotiff.GeoTiffReader.<init>(GeoTiffReader.java:202)
at org.geotools.gce.geotiff.GeoTiffReader.<init>(GeoTiffReader.java:155)
at org.jgrasstools.gears.io.rasterreader.OmsRasterReader.readGeotiff(OmsRasterReader.java:352)
at org.jgrasstools.gears.io.rasterreader.OmsRasterReader.process(OmsRasterReader.java:256)
at org.jgrasstools.gears.io.rasterreader.OmsRasterReader.readRaster(OmsRasterReader.java:493)
at feras.hillshade.HillshadeTesting.main(HillshadeTesting.java:24)

I would be grateful to know what is the main problem. If you have sample input, this will be great as this might be the problem.

Many thanks in advance!
Feras

andrea antonello

unread,
Oct 19, 2014, 3:51:19 PM10/19/14
to jgras...@googlegroups.com
> Thank you for your comment, I now wrote the code as follows:
>
> public class HillshadeTesting {
>
> private static IJGTProgressMonitor pm = new LogProgressMonitor();
>
> public static void main(String[] args) throws Exception {
> String inputPath = "C:\\localdata\\sunimage_wgs84.tif";
> String outPutPath = "C:\\localdata\\";
> GridCoverage2D elevationCoverage = OmsRasterReader.readRaster(inputPath);
>
> OmsHillshade hillshade = new OmsHillshade();
> hillshade.inElev = elevationCoverage;
> hillshade.pElev = 45.0;
> hillshade.pAzimuth = 315;
> hillshade.pm = pm;
>
> hillshade.process();
> GridCoverage2D hillshadeCoverage = hillshade.outHill;
> OmsRasterWriter.writeRaster(outPutPath, hillshadeCoverage);
>
> }
> }


That is almost perfect. The output needs to be a file name:

String outPutPath = "C:\\localdata\\youroutput.tiff";
or
String outPutPath = "C:\\localdata\\youroutput.asc";
depending on the format you want.


Try it like that, it should work.

Andrea

Feras Obeidat

unread,
Oct 20, 2014, 10:38:09 AM10/20/14
to jgras...@googlegroups.com
Hello Andrea,

Thanks for your advice. I changed the code and I think  I' m almost there,  however, I couldn't open the tiff output. When I try to open it, I get this error: "This is not a valid bitmap file, or its format is not currently supported".

And this the output from eclipse console:

Reading coverage: sunimage_wgs84.tif
Oct 20, 2014 10:35:42 AM it.geosolutions.imageio.gdalframework.GDALUtilities loadGDAL
WARNING: Failed to load the GDAL native libs. This is not a problem unless you need to use the GDAL plugins: they won't be enabled.
java.lang.UnsatisfiedLinkError: no gdaljni in java.library.path
Error while parsing JAI registry file "file:/C:/Users/IBM_ADMIN/.m2/repository/org/jaitools/jt-all/1.3.0/jt-all-1.3.0.jar!/META-INF/registryFile.jai" :
Error in registry file at line number #59
A descriptor is already registered against the name "VectorBinarize" under registry mode "rendered"
Finished.
working on hillshade
0%...
10%...
20%...
30%...
40%...
50%...
60%...
70%...
80%...
90%...
Finished.
Writing coverage: sunimageoutput1.tiff
Finished.

Thanks in advance!
Feras 

andrea antonello

unread,
Oct 21, 2014, 10:59:39 AM10/21/14
to jgras...@googlegroups.com
> Thanks for your advice. I changed the code and I think I' m almost there,
> however, I couldn't open the tiff output. When I try to open it, I get this
> error: "This is not a valid bitmap file, or its format is not currently
> supported".

When you open it with what? I assume not with a GIS.
The resulting tiff is a floating point geotiff, it doesn't have a
colortable and can be read only with a GIS.

Andrea

Feras Obeidat

unread,
Oct 21, 2014, 11:13:52 AM10/21/14
to jgras...@googlegroups.com
Hi Andrea,
I am using normal viewer to show the image, not GIS. So, this is the problem then. Is it possible to view it through JGrass?

Thanks for your reply
Feras

andrea antonello

unread,
Oct 21, 2014, 11:22:37 AM10/21/14
to jgras...@googlegroups.com
> I am using normal viewer to show the image, not GIS. So, this is the problem
> then. Is it possible to view it through JGrass?

JGrass is completely integrated in uDig.
We use uDig to view those data.
http://udig.refractions.net/
Just download the latest version and drag the tiff into it.

When you first drag it into it, it doesn't have a colortable, so you
will need to use the styler:
http://udig.github.io/docs/user/reference/Raster%20Style%20Pages.html#single-band-rasters

There is a mailinglist for uDig in case you have issues.

Andrea

Feras Obeidat

unread,
Oct 22, 2014, 9:10:49 AM10/22/14
to jgras...@googlegroups.com
Thanks Andrea, that works fine!

Feras Obeidat

unread,
Oct 24, 2014, 1:31:39 PM10/24/14
to jgras...@googlegroups.com
Hi Andrea,

I have used as per attached the tif file (srtm_15_03.tif) and I can view it through ArcGIS and uDig. However, when I try to run the hillshade code I get an error. I might be missing some parameters. The code and the error I get is is also attached here.

Your help is highly appreciated.Thank in advance 
ps: I couldn't upload srtm_15_03.tif here. maybe due size

The java code:
public class Hillshade1 {

private static IJGTProgressMonitor pm = new LogProgressMonitor();

public static void main(String[] args) throws Exception {

String inputPath = "C:\\localdata\\input\\srtm_15_03.tif";
String outPutPath = "C:\\localdata\\output\\srtm_15_03_Out.tiff"; // asc

GridCoverage2D elevationCoverage = OmsRasterReader
.readRaster(inputPath);
OmsHillshade hillshade = new OmsHillshade();
hillshade.inElev = elevationCoverage;
hillshade.pElev = 45.0;
hillshade.pAzimuth = 310;
hillshade.pm = pm;
hillshade.process();
GridCoverage2D hillshadeCoverage = hillshade.outHill;
OmsRasterWriter.writeRaster(outPutPath, hillshadeCoverage);

}
}

The error:
Reading coverage: srtm_15_03.tif
Oct 24, 2014 1:13:16 PM it.geosolutions.imageio.gdalframework.GDALUtilities loadGDAL
WARNING: Failed to load the GDAL native libs. This is not a problem unless you need to use the GDAL plugins: they won't be enabled.
java.lang.UnsatisfiedLinkError: no gdaljni in java.library.path
Oct 24, 2014 1:13:16 PM org.geotools.gce.image.WorldImageReader readCRS
INFO: Type "PROJECTION" is unknow in this context.
org.opengis.referencing.FactoryException: Type "PROJECTION" is unknow in this context.
at org.geotools.referencing.factory.ReferencingObjectFactory.createFromWKT(ReferencingObjectFactory.java:1096)
at org.geotools.data.PrjFileReader.<init>(PrjFileReader.java:89)
at org.geotools.data.PrjFileReader.<init>(PrjFileReader.java:63)
at org.geotools.gce.image.WorldImageReader.readCRS(WorldImageReader.java:648)
at org.geotools.gce.image.WorldImageReader.<init>(WorldImageReader.java:255)
at org.geotools.gce.image.WorldImageReader.<init>(WorldImageReader.java:119)
at org.jgrasstools.gears.io.rasterreader.OmsRasterReader.readGeotiff(OmsRasterReader.java:350)
at org.jgrasstools.gears.io.rasterreader.OmsRasterReader.process(OmsRasterReader.java:256)
at org.jgrasstools.gears.io.rasterreader.OmsRasterReader.readRaster(OmsRasterReader.java:493)
at Hillshade.Feras.Hillshade1.main(Hillshade1.java:33)
Caused by: java.text.ParseException: Type "PROJECTION" is unknow in this context.
at org.geotools.referencing.wkt.Parser.parseCoordinateReferenceSystem(Parser.java:236)
at org.geotools.referencing.wkt.Parser.parseCoordinateReferenceSystem(Parser.java:204)
at org.geotools.referencing.factory.ReferencingObjectFactory.createFromWKT(ReferencingObjectFactory.java:1090)
... 9 more

Oct 24, 2014 1:13:17 PM org.geotools.gce.image.WorldImageReader readCRS
INFO: Unable to find crs, continuing with default CRS
Error while parsing JAI registry file "file:/C:/Users/IBM_ADMIN/.m2/repository/org/jaitools/jt-all/1.3.0/jt-all-1.3.0.jar!/META-INF/registryFile.jai" :
Error in registry file at line number #59
A descriptor is already registered against the name "VectorBinarize" under registry mode "rendered"
Finished.
Exception in thread "main" java.lang.RuntimeException: Cannot construct DataBuffer.
at com.sun.media.jai.util.DataBufferUtils.constructDataBuffer(DataBufferUtils.java:132)
at com.sun.media.jai.util.DataBufferUtils.createDataBufferDouble(DataBufferUtils.java:293)
at javax.media.jai.ComponentSampleModelJAI.createDataBuffer(ComponentSampleModelJAI.java:274)
at javax.media.jai.RasterFactory.createWritableRaster(RasterFactory.java:691)
at org.jgrasstools.gears.utils.coverage.CoverageUtilities.createDoubleWritableRaster(CoverageUtilities.java:204)
at org.jgrasstools.hortonmachine.modules.hydrogeomorphology.hillshade.OmsHillshade.normalVector(OmsHillshade.java:217)
at org.jgrasstools.hortonmachine.modules.hydrogeomorphology.hillshade.OmsHillshade.process(OmsHillshade.java:118)
at Hillshade.Feras.Hillshade1.main(Hillshade1.java:39)


On Tue, Oct 21, 2014 at 10:59 AM, andrea antonello <andrea.a...@gmail.com> wrote:
> Thanks for your advice. I changed the code and I think  I' m almost there,
> however, I couldn't open the tiff output. When I try to open it, I get this
> error: "This is not a valid bitmap file, or its format is not currently
> supported".

When you open it with what? I assume not with a GIS.
The resulting tiff is a floating point geotiff, it doesn't have a​
You received this message because you are subscribed to a topic in the Google Groups "jgrasstools" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jgrasstools/7inP2WAqihw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jgrasstools...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Feras Al-Obeidat, Ph.D.

Research Scientist
IBM Canada Research & Development Centre
IBM Canada,  Markham, Canada



Reply all
Reply to author
Forward
0 new messages