transformation - Error in using gdal java binding -
i using java binding of gdal project set of coordinate points utm lat/log using coordinatetransformation class of gdal. have written code follows:
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]);
but when run in main function, following error: exception in thread "main" java.lang.unsatisfiedlinkerror:
org.gdal.osr.osrjni.new_spatialreference__swig_1()j @ org.gdal.osr.osrjni.new_spatialreference__swig_1(native method) @ org.gdal.osr.spatialreference.<init>(spatialreference.java:117) @ controller.crsconvertergdal.main(crsconvertergdal.java:8)
does know how can fixed? thanks,
i tried executing source code , got error
native library load failed. java.lang.unsatisfiedlinkerror: no osrjni in java.library.path
so adding gdal.jar
in project build path not sufficient executing program. there external native library dependencies.
check out link,https://trac.osgeo.org/gdal/ticket/3598. here mentioned,
the gdaljni.dll, ogrjni.dll, gdalconstjni.dll , osrjni.dll gdal17.dll , other dependant libraries must in path.
and in order generate these dll windows os , include them in build path, steps mentioned here, https://trac.osgeo.org/gdal/wiki/gdalogrinjavabuildinstructions
i have not tried steps mentioned in above link, seem straight forward. if face issues let know, try , see.
hope helps.
Comments
Post a Comment