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.
ps: I couldn't upload srtm_15_03.tif here. maybe due size
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);
}
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)