我正在使用gdal的java绑定来使用gdal的CoordinateTransformation类将一组坐标点从UTM投影到纬度/日志。我写的代码如下:使用gdal java绑定时出错
SpatialReference oUTM = new SpatialReference();
SpatialReference oLatLog = new SpatialReference();
oUTM.SetProjCS("UTM 44/ WGS84");
oUTM.SetWellKnownGeogCS("WGS84");
oUTM.SetUTM(44, 1);
oLatLog = oUTM.CloneGeogCS();
double[] arr = new double[2];
arr[0]=10;
arr[1]=10;
double x = arr[0] , y = arr[1];
CoordinateTransformation transform = new CoordinateTransformation(oUTM,oLatLog);
transform.TransformPoint(arr);
System.out.println("Before:"+x+" "+y+"\nAfter:"+arr[0]+" "+arr[1]);
但是,当我在我的主要功能运行它,我得到以下错误: 异常线程“main” java.lang.UnsatisfiedLinkError中:
org.gdal.osr.osrJNI.new_SpatialReference__SWIG_1()J
at org.gdal.osr.osrJNI.new_SpatialReference__SWIG_1(Native Method)
at org.gdal.osr.SpatialReference.<init>(SpatialReference.java:117)
at controller.CrsConverterGDAL.main(CrsConverterGDAL.java:8)
有谁知道如何解决这个问题? 谢谢,
感谢您的回答。 :)。我通过链接本地库来修复它。我在eclipses运行时环境中设置了GDAL_DATA和LD_LIBRARY_PATH变量。我使用的是Ubuntu,所以它们与上面提到的不同。再次感谢。 :) – zelta
感谢您的反馈,我会相应地编辑答案 –