我正在尝试运行GeoTools ImageLab.java exmaple。它在Eclipse中工作正常,我在使用Maven时如说明书中那样。我正在尝试加载GeoTIFF。但是当我使用Eclipse构建一个可运行的jar文件并从DOS命令行运行时,我得到:
Jun 11, 2018 6:49:57 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
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.lang.UnsupportedOperationException: Trying to get a reader from an unknown format.
at org.geotools.coverage.grid.io.UnknownFormat.getReader(UnknownFormat.java:53)
at org.geotools.tutorial.raster.ImageLab.displayLayers(ImageLab.java:103)
at org.geotools.tutorial.raster.ImageLab.getLayersAndDisplay(ImageLab.java:87)
at org.geotools.tutorial.raster.ImageLab.main(ImageLab.java:61)
JNI引用让我觉得我需要一个gdal dll文件,但如果是这样的话,我很难找到一个。
所有帮助表示赞赏!提前谢谢。
答案 0 :(得分:1)
如果您使用gt-imageio-ext-gdal
module,那么您需要确保JVM可以看到您的gdal库,并且它们是模块所期望的确切版本。有关如何在相关GeoServer page上安装该详细说明。
但是,对于简单的GeoTiff,不需要GDAL,因为这是由gt-geotiff
module处理的。
最后,如果您正在尝试构建单个jar应用程序,则应确保已阅读并理解此FAQ entry。