Skip to content
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

Add GDAL with Java Bindings Support #138

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

buehner
Copy link
Member

@buehner buehner commented Jan 23, 2025

This pull request allows the integration of GDAL into the resulting GeoServer docker image. With a specific focus on building the Java bindings. Unlike the default Ubuntu package sources (like gdal-bin), which do not only provide an outdated version, but especially do not provide the Java bindings, this implementation ensures full compatibility with GDAL.

Related links:

Usage: docker build --build-arg BUILD_GDAL=true -t my-geoserver-image .

Note: On average hardware, this takes ~10-15 mins, which is the reason to set the default for BUILD_GDAL to false (which results in the same docker image as before). There are two more new build arguments for optional use: PROJ_VERSION=9.5.1 and GDAL_VERSION=3.10.1

The use of --build-arg BUILD_GDAL=true leads to an increase of the resulting image of (only!) ~200MB as the installation of gdal requires some dependent packages to be installed, but the footprint is still "minimal" as we pick the build artifacts with COPY --from=gdal_builder.

I added the --build-arg BUILD_GDAL=true to the release script, so all future "official" GS docker image builds should contain GDAL with JAVA Bindings.

Comparison "Before vs After"

Use this to start your image with the gdal extension, which can be used to test the gdal functionality:
docker run -it -p 8080:8080 --env INSTALL_EXTENSIONS=true --env STABLE_EXTENSIONS="gdal" my-geoserver-image

Before (without GDAL Java Bindings)

GeoServer-Log:

Native library load failed.
java.lang.UnsatisfiedLinkError: no gdalalljni in java.library.path: /usr/local/lib:/usr/local/tomcat/native-jni-lib:/usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib
23-Jan-2025 11:40:07.783 WARNING [main] it.geosolutions.imageio.gdalframework.GDALUtilities.loadGDAL 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: 'void org.gdal.gdal.gdalJNI.AllRegister()'

no-bindings

After (with GDAL Java Bindings)

GeoServer-Log:

23-Jan-2025 11:38:24.013 INFO [main] it.geosolutions.imageio.gdalframework.GDALUtilities.loadGDAL GDAL Native Library loaded (version: 3.10.1)

bindings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant