Skip to content

Changes to use externally installed GDAL library #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jun 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 73 additions & 22 deletions GDAL_README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,41 +6,92 @@

# $Id: GDAL_README.txt 1171 2013-02-11 21:45:02Z dcollins $

This document provides guidance on deploying applications that use the WorldWind GDAL libraries.
This document provides guidance on deploying applications that use the
WorldWind GDAL libraries.

Building
------------------------------------------------------------
If building with 'ant', using the 'build.xml' file, change the
'gdal.win.properties' or 'gdal.unix.properties' files to
reflect the location of the GDAL library files on your system.

Version
Deploying applications
------------------------------------------------------------
Worldwind users should install a binary edition of GDAL,
including the Java interface (gdal.jar, gdalalljni.lib/libgdalalljni.so).

WorldWind uses GDAL version 1.7.2, and LizardTech's Decode SDK version 7.0.0.2167.
- The classpath used to build/execute Worldwind must include
the location of the gdal.jar file.
- On Windows, the 'java.libary.path' property must be set to
the location of the JNI shared library. In addition, if
the DLLs are not in the same directory as the launched
application, the PATH environment variable should be set to
include the location of the shared libraries. Note that if
'java.library.path' is not explicitly set, the JVM's default
includes PATH plus the current directory.
- On Linux, the LD_LIBRARY_PATH environment variable should be
set to include the location of the JNI shared library. The
JVM will include the paths in LD_LIBRARY_PATH in the
'java.library.path' property.

- Unless the GDAL_DATA environment variable is set, the GDAL
data directory will be searched for, using the property
"user.dir", and then in some standard locations.

Supported Platforms
------------------------------------------------------------
- Unless the GDAL_DRIVER_PATH environment variable is set, the
GDAL plugins direoctory will be searched for, using the property
"user.dir", and then in some standard locations.

WorldWind supports Windows 32/64-bit, Linux 32/64-bit, and Mac OSX. The WorldWind SDK therefore contains
GDAL, PROJ4, and MRSiD binaries for the following platforms:
- MacOSX universal
- Windows 32-bit and Windows 64-bit
- Linux 32-bit and Linux 64-bit

Binary distributions are available for both Windows and
Linux. See
https://trac.osgeo.org/gdal/wiki/DownloadingGdalBinaries.

WorldWind GDAL Libraries
------------------------------------------------------------
For Ubuntu, the package "libgdal-java" contains the 'gdal.jar'
and JNI shared library.

GDAL versions earlier that 2.3.2 split the JNI library into
five separate files. They all need to be in paths listed in
'java.library.path' or 'LD_LIBRARY_PATH'.

The GISInternals binary package for Windows uses this
directory structure:

C:\Program Files\GDAL shared libraries, including JNI shared library
C:\Program Files\GDAL\java\gdal.jar GDAL Java interface
C:\Program Files\GDAL\gdal-data GDAL data directory
C:\Program Files\GDAL\gdalplugins GDAL plugin directory


The Ubuntu Linux distribution uses these locations:

/usr/lib: shared libraries
/usr/share/java/gdal.jar GDAL Java interface
/usr/lib/jni GDAL JNI shared library
/usr/share/gdal/2.2 GDAL data directory
/usr/lib/gdalplugins GDAL plugin directory

There's a bug in the Ubuntu Bionic 18.04.2 LTS that prevents
the Grass plugin from loading properly (see
https://trac.osgeo.org/osgeolive/ticket/2068). The workaround
is to

setenv LD_LIBRARY_PATH=/usr/lib/jni:/usr/lib/grass74/lib

To simplify deployment, our GDAL+PRO4+MRSID bundles are compiled as a single dynamic library which has all dependent
libraries statically compiled. As a result we have one dynamic library "gdalall" per OS / per platform. Each platfor
library is located under the "lib-external/gdal/" folder.
Pre-built binaries for the MrSID and ERDAS ECW formats are not
available on Ubuntu. Instructions for building the plugins is
available here:

GDAL and PROJ4 libraries require data tables located in the lib-external/gdal/data folder. We recommend placing these
tables in the "data" sub-folder.
https://trac.osgeo.org/gdal/wiki/ECW
https://trac.osgeo.org/gdal/wiki/MrSID


WWJ attempts to locate GDAL bundles during the startup. By default WWJ will first look for GDAL native binaries in the
current path, then in to the lib-external/gdal/ folder. If no GDAL bundle was found WorldWind attempts to locate the
GDAL bundle in the sub-folders. Therefore we recommend one of two options:
1) Place the GDAL libraries in the folder "lib-external/gdal".
2) Place the GDAL libraries in the application's root folder.
MrSID SDK
https://www.extensis.com/support/developers

ERDAS ECW SDK
https://www.hexagongeospatial.com/products/power-portfolio/compression-products/erdas-ecw-jp2-sdk


Deploying with Java Web Start
------------------------------------------------------------
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ binary JAR files as follows:
deployed with the application.
4. When running, specify the JVM argument -Djogamp.gluegen.UseTempJarCache=false

## GDAL

GDAL is a translator library for raster and vector geospatial data formats provided by the Open Source Geospatial Foundation. GDAL libraries and native binaries are not provided by WorldWindEarth/WorldWind Java, but are needed to build. The Gradle build will pull the necessary libraries from Maven. Please see the file GDAL_README.txt for details on where to obtain the native binaries and other details.

## License

NASA WORLDWIND
Expand Down
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ targetCompatibility = '1.8'

ext {
joglVersion = '2.3.2'
gdalVersion = '2.4.0'
jacksonVersion = '1.9.13'
junitVersion = '4.5'
}
Expand All @@ -22,7 +23,7 @@ dependencies {
implementation "org.jogamp.jogl:jogl-all-main:${project.joglVersion}"
implementation "org.jogamp.gluegen:gluegen-rt-main:${project.joglVersion}"

compile files('gdal.jar')
compile "org.gdal:gdal:${project.gdalVersion}"

implementation "org.codehaus.jackson:jackson-core-asl:${project.jacksonVersion}"

Expand Down
109 changes: 32 additions & 77 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,15 @@
<!-- Import the ANT build properties and project ANT macros. -->

<property file="build.properties"/>
<condition property="gdal.properties" value="gdal.win.properties">
<os family="windows"/>
</condition>
<condition property="gdal.properties" value="gdal.unix.properties">
<os family="unix"/>
</condition>
<property file="${gdal.properties}"/>
<import file="build.macros.xml"/>

<!-- Main build targets. Provides generic targets that compile the Java sources, bundle JAR libraries, assemble API
documentation, test the Java sources, and clean up the build output. -->

Expand Down Expand Up @@ -47,7 +54,7 @@
<pathelement location="${basedir}/jackson-core-asl.jar"/>
<pathelement location="${basedir}/jogl-all.jar"/>
<pathelement location="${basedir}/gluegen-rt.jar"/>
<pathelement location="${basedir}/gdal.jar"/>
<pathelement location="${gdal.jar.dir}/gdal.jar"/>
</pathelements>
</compileJava>
</target>
Expand All @@ -60,7 +67,7 @@
<pathelement location="${basedir}/jackson-core-asl.jar"/>
<pathelement location="${basedir}/jogl-all.jar"/>
<pathelement location="${basedir}/gluegen-rt.jar"/>
<pathelement location="${basedir}/gdal.jar"/>
<pathelement location="${gdal.jar.dir}/gdal.jar"/>
</pathelements>
</compileJava>
</target>
Expand Down Expand Up @@ -101,7 +108,7 @@
<pathelement location="jackson-core-asl.jar"/>
<pathelement location="jogl-all.jar"/>
<pathelement location="gluegen-rt.jar"/>
<pathelement location="gdal.jar"/>
<pathelement location="${gdal.jar.dir}/gdal.jar"/>
</classpath>
<link href="http://download.oracle.com/javase/8/docs/api/"/>
<link href="https://jogamp.org/deployment/v2.1.5/javadoc/jogl/javadoc/"/>
Expand Down Expand Up @@ -171,12 +178,12 @@
</fileset>
</jar>
<!-- GDAL library JAR files. -->
<copy file="${basedir}/gdal.jar" todir="${webstart.unsigned.dir}"/>
<copy file="${gdal.jar.dir}/gdal.jar" todir="${webstart.unsigned.dir}"/>
<jar jarfile="${webstart.unsigned.dir}/gdaldata.jar">
<manifest>
<attribute name="Permissions" value="all-permissions"/>
</manifest>
<fileset dir="${basedir}/lib-external/gdal/data">
<fileset dir="${gdal.data.dir}">
<include name="**"/>
<type type="file"/>
</fileset>
Expand All @@ -186,68 +193,30 @@
<manifest>
<attribute name="Permissions" value="all-permissions"/>
</manifest>
<fileset dir="${basedir}/lib-external/gdal">
<include name="GDAL_License.txt"/>
<include name="LizardTech_DSDK_License.txt"/>
<include name="LizardTech_3rd_Party.txt"/>
<include name="LizardTech_Redistributable.txt"/>
<include name="libgdalalljni.jnilib"/>
<type type="file"/>
</fileset>
</jar>
<jar jarfile="${webstart.unsigned.dir}/gdal-natives-windows-i586.jar">
<manifest>
<attribute name="Permissions" value="all-permissions"/>
</manifest>
<fileset dir="${basedir}/lib-external/gdal">
<include name="GDAL_License.txt"/>
<include name="LizardTech_DSDK_License.txt"/>
<include name="LizardTech_3rd_Party.txt"/>
<include name="LizardTech_Redistributable.txt"/>
<include name="gdalminjni32.dll"/>
<include name="gdalalljni32.dll"/>
<include name="gdalalljni32.dll.manifest"/>
<fileset dir="${gdal.jni.dir}">
<include name="lib*jni.jnilib"/>
<type type="file"/>
</fileset>
</jar>
<jar jarfile="${webstart.unsigned.dir}/gdal-natives-windows-amd64.jar">
<jar jarfile="${webstart.unsigned.dir}/gdal-natives-window.jar">
<manifest>
<attribute name="Permissions" value="all-permissions"/>
</manifest>
<fileset dir="${basedir}/lib-external/gdal">
<include name="GDAL_License.txt"/>
<include name="LizardTech_DSDK_License.txt"/>
<include name="LizardTech_3rd_Party.txt"/>
<include name="LizardTech_Redistributable.txt"/>
<include name="gdalminjni64.dll"/>
<include name="gdalalljni64.dll"/>
<include name="gdalalljni64.dll.manifest"/>
<fileset dir="${gdal.jni.dir}">
<include name="*jni.dll"/>
<type type="file"/>
</fileset>
</jar>
<jar jarfile="${webstart.unsigned.dir}/gdal-natives-linux-i586.jar">
<jar jarfile="${webstart.unsigned.dir}/gdal-natives-linux.jar">
<manifest>
<attribute name="Permissions" value="all-permissions"/>
</manifest>
<fileset dir="${basedir}/lib-external/gdal">
<fileset dir="${gdal.jni.dir}">
<include name="GDAL_License.txt"/>
<include name="LizardTech_DSDK_License.txt"/>
<include name="LizardTech_3rd_Party.txt"/>
<include name="LizardTech_Redistributable.txt"/>
<include name="libgdalalljni32.so"/>
<type type="file"/>
</fileset>
</jar>
<jar jarfile="${webstart.unsigned.dir}/gdal-natives-linux-amd64.jar">
<manifest>
<attribute name="Permissions" value="all-permissions"/>
</manifest>
<fileset dir="${basedir}/lib-external/gdal">
<include name="GDAL_License.txt"/>
<include name="LizardTech_DSDK_License.txt"/>
<include name="LizardTech_3rd_Party.txt"/>
<include name="LizardTech_Redistributable.txt"/>
<include name="libgdalalljni64.so"/>
<include name="lib*jni.so*"/>
<type type="file"/>
</fileset>
</jar>
Expand Down Expand Up @@ -326,7 +295,7 @@
<pathelement location="${basedir}/jackson-core-asl.jar"/>
<pathelement location="${basedir}/jogl-all.jar"/>
<pathelement location="${basedir}/gluegen-rt.jar"/>
<pathelement location="${basedir}/gdal.jar"/>
<pathelement location="${gdal.jar.dir}/gdal.jar"/>
<pathelement location="${basedir}/junit-4.5.jar"/>
</pathelements>
</compileJava>
Expand All @@ -347,7 +316,7 @@
<pathelement location="${basedir}/jackson-core-asl.jar"/>
<pathelement location="${basedir}/jogl-all.jar"/>
<pathelement location="${basedir}/gluegen-rt.jar"/>
<pathelement location="${basedir}/gdal.jar"/>
<pathelement location="${gdal.jar.dir}/gdal.jar"/>
<pathelement location="${basedir}/junit-4.5.jar"/>
</classpath>
<batchtest todir="${worldwind.test.results.dir}"
Expand Down Expand Up @@ -497,25 +466,6 @@
manifest="${jogl.jarfiles.dir}/gluegen-rt-natives-linux-amd64/META-INF/MANIFEST.MF"/>
</target>

<!-- Helper tasks for bundling and unbundling the GDAL JAR file. These targets are used to modify the contents of
the GDAL JAR file, which are currently not under source control. -->

<target name="help.unpackGdal">
<property name="gdal.jarfile.dir" location="gdal-jar"/>
<mkdir dir="${gdal.jarfile.dir}"/>
<unzip src="gdal.jar" dest="${gdal.jarfile.dir}"/>
</target>

<target name="help.packGdal">
<property name="gdal.jarfile.dir" location="gdal-jar"/>
<delete file="gdal.jar"/>
<jar destfile="gdal.jar" basedir="${gdal.jarfile.dir}">
<manifest>
<attribute name="Permissions" value="all-permissions"/>
</manifest>
</jar>
</target>

<!-- Helper tasks for bundling and unbundling the VPF symbols JAR file. These targets are used to modify the
contents of the VPF symbols JAR file, which are currently not under source control. -->

Expand Down Expand Up @@ -555,10 +505,15 @@
</target>

<target name="runLayerManager" depends="build" description="Runs the LayerManager example app.">
<java fork="true"
classname="gov.nasa.worldwindx.examples.layermanager.LayerManagerApp"
classpath="gdal.jar;gluegen-rt-natives-linux-amd64.jar;gluegen-rt-natives-linux-i586.jar;gluegen-rt-natives-macosx-universal.jar;gluegen-rt-natives-windows-amd64.jar;gluegen-rt-natives-windows-i586.jar;gluegen-rt.jar;jackson-core-asl.jar;jogl-all-natives-linux-amd64.jar;jogl-all-natives-linux-i586.jar;jogl-all-natives-macosx-universal.jar;jogl-all-natives-windows-amd64.jar;jogl-all-natives-windows-i586.jar;jogl-all.jar;junit-4.5.jar;vpf-symbols.jar;worldwind.jar;worldwindx.jar"
/>
<echoproperties/>
<java fork="true"
classname="gov.nasa.worldwindx.examples.layermanager.LayerManagerApp"
classpath="${gdal.jar.dir}/gdal.jar;gluegen-rt-natives-linux-amd64.jar;gluegen-rt-natives-linux-i586.jar;gluegen-rt-natives-macosx-universal.jar;gluegen-rt-natives-windows-amd64.jar;gluegen-rt-natives-windows-i586.jar;gluegen-rt.jar;jackson-core-asl.jar;jogl-all-natives-linux-amd64.jar;jogl-all-natives-linux-i586.jar;jogl-all-natives-macosx-universal.jar;jogl-all-natives-windows-amd64.jar;jogl-all-natives-windows-i586.jar;jogl-all.jar;junit-4.5.jar;vpf-symbols.jar;worldwind.jar;worldwindx.jar"
>
<env key="GDAL_DATA" path="${gdal.data.dir}"/>
<env key="GDAL_DRIVER_PATH" path="${gdal.plugins.dir}"/>
<sysproperty key="java.util.logging.config.file" value="${basedir}/logging.properties"/>
</java>
</target>

</project>
Binary file removed gdal.jar
Binary file not shown.
6 changes: 6 additions & 0 deletions gdal.unix.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# GDAL library locations
gdal.jar.dir=/usr/share/java
gdal.jni.dir=/usr/lib/jni
gdal.data.dir=/usr/share/gdal/2.2
gdal.plugins.dir=/usr/lib/gdalplugins

5 changes: 5 additions & 0 deletions gdal.win.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# GDAL library locations
gdal.jar.dir=c:/Program Files/GDAL/java
gdal.jni.dir=c:/Program Files/GDAL
gdal.data.dir=c:/Program Files/GDAL/gdal-data
gdal.plugins.dir=c:/Program Files/GDAL/gdalplugins
Loading