Error while running Hillshade

62 views
Skip to first unread message

Feras Obeidat

unread,
Oct 24, 2014, 1:27:17 PM10/24/14
to jgras...@googlegroups.com

Dear all,

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.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)

Silvia Franceschi

unread,
Oct 28, 2014, 5:23:16 AM10/28/14
to jgras...@googlegroups.com
Dear Feras,
as you can read in the error message:
"INFO: Type "PROJECTION" is unknow in this context.
org.opengis.referencing.FactoryException: Type "PROJECTION" is unknow in this context."
The file do not have any informatio about the projection, so the JGrassTools do not work. You have to add a prj file to the raster file, same as you usually use for vectors.

Silvia


--
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 28, 2014, 8:42:46 AM10/28/14
to jgras...@googlegroups.com
Dear Silvia,

Thanks for your response. Is there any clue on how to add prj file to raster file. Is there an example ?

Cheers
Feras

Silvia Franceschi

unread,
Oct 28, 2014, 8:45:21 AM10/28/14
to jgras...@googlegroups.com
You can use the specific command in the Catalog View of uDig or just add the same prj file as the shapefile. Copy and paste in the raster folder the prj from a shapefile of the same projection and rename it with the name of the raster.

Silvia
Reply all
Reply to author
Forward
0 new messages