Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

274.1. gdal-3.13.3

Raster and vector geospatial data format library

Version 3.13.3, release 3
Shelf gis — GIS, maps, projections, GPS, navigation and location
Phase 43_toolkits (Toolkits), 145 of 344 in build order
Licence MIT
Homepage https://gdal.org/
Build time 25.5 SBU
Installed size 56.4 MiB in 749 files
Recipe ports/core/gis/gdal/kpkgbuild

About

GDAL (the Geospatial Data Abstraction Library) reads and writes raster and vector geospatial formats behind one API: GeoTIFF, shapefiles, GeoPackage, NetCDF, HDF5, PostGIS and many more, with coordinate transformations through proj and geometry operations through geos. It installs the gdal command and the classic tools such as gdalinfo, gdal_translate and ogr2ogr, and the osgeo Python module. qgis, qmapshack and pdal are built on it.

Why it is in KDOS

The comment above gdal and osm-gps-map in script/phases/43_toolkits/packages.d/gis.txt:

150+ raster and vector formats behind one API. GDAL_USE_CURL=OFF for proj's reason: /vsicurl/ turns a dataset path into an HTTP client.

Sources

Dependencies

Depends on: cmake, ninja, proj, geos, sqlite, libtiff, libjpeg-turbo, libpng, zlib, zstd, expat, libxml2, openssl, libarchive, netcdf-c, hdf5, openjpeg, libwebp, lz4, xz, pcre2, json-c, postgresql, giflib, libheif, libavif, libjxl, openexr, imath, cfitsio, libaec, libdeflate, qhull, poppler, python3, python3-setuptools, swig, numpy, freexl, xerces-c, libspatialite, c-blosc.

Required by (3): pdal, qgis, qmapshack.

Optional, off in KDOS

These switches in build.sh turn off a feature whose library is a port here. The recipe may turn each off on purpose, or because the library was not yet a port when the recipe was written; this list cannot tell which.

Installation

From the repository root, inside the build container, this is the line kdosbuild runs for the port:

script/chroot/exec.sh bash -c 'source script/phases/43_toolkits/phase.env && kpkg install gdal'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/gis/gdal.

1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.

cd /ports/core/gis/gdal
echo '5e0c388d83da2d686cc00a40272882432cdb54edff43d4af173e532844a0a0ea  gdal-3.13.3.tar.gz' | sha256sum -c -

2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.

SRC_ROOT=/var/cache/kpkg/work/gdal
SRC=$SRC_ROOT/gdal-3.13.3
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf gdal-3.13.3.tar.gz -C "$SRC" --strip-components=1

Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.

3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

mkdir -p build && cd build
cmake .. -G Ninja -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
	-DCMAKE_BUILD_TYPE=Release \
	-DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=lib \
	-DBUILD_PYTHON_BINDINGS=ON \
	-DBUILD_JAVA_BINDINGS=OFF \
	-DBUILD_CSHARP_BINDINGS=OFF \
	-DBUILD_TESTING=OFF \
	-DGDAL_USE_EXTERNAL_LIBS=OFF \
	-DGDAL_USE_CURL=OFF \
	-DGDAL_USE_POPPLER=ON \
	-DGDAL_USE_PDFIUM=OFF \
	-DGDAL_USE_ZLIB=ON \
	-DGDAL_USE_ICONV=ON \
	-DGDAL_USE_OPENMP=ON \
	-DGDAL_USE_GEOS=ON \
	-DGDAL_USE_SQLITE3=ON \
	-DGDAL_USE_PCRE2=ON \
	-DGDAL_USE_POSTGRESQL=ON \
	-DGDAL_USE_TIFF=ON \
	-DGDAL_USE_JPEG=ON \
	-DGDAL_USE_PNG=ON \
	-DGDAL_USE_GIF=ON \
	-DGDAL_USE_WEBP=ON \
	-DGDAL_USE_OPENJPEG=ON \
	-DGDAL_USE_HEIF=ON \
	-DGDAL_USE_AVIF=ON \
	-DGDAL_USE_JXL=ON \
	-DGDAL_USE_JXL_THREADS=ON \
	-DGDAL_USE_OPENEXR=ON \
	-DGDAL_USE_CFITSIO=ON \
	-DGDAL_USE_NETCDF=ON \
	-DGDAL_USE_HDF5=ON \
	-DGDAL_USE_LIBAEC=ON \
	-DGDAL_USE_ZSTD=ON \
	-DGDAL_USE_DEFLATE=ON \
	-DGDAL_USE_LZ4=ON \
	-DGDAL_USE_LIBLZMA=ON \
	-DGDAL_USE_ARCHIVE=ON \
	-DGDAL_USE_EXPAT=ON \
	-DGDAL_USE_LIBXML2=ON \
	-DGDAL_USE_OPENSSL=ON \
	-DGDAL_USE_JSONC=ON \
	-DGDAL_USE_QHULL=ON \
	-DGDAL_USE_FREEXL=ON \
	-DGDAL_USE_XERCESC=ON \
	-DGDAL_USE_SPATIALITE=ON \
	-DGDAL_USE_BLOSC=ON
ninja
DESTDIR=$PKG ninja install
ls "$PKG"/usr/lib/python3*/site-packages/osgeo/_gdal_array*.so >/dev/null 2>&1 || {
	echo 'gdal: osgeo.gdal_array was not built; numpy was not found' >&2
	exit 1
}

The switches, and why each is set:

The common switches of each build system are explained in the Flag glossary.

4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/gdal, prunes what the image does not ship, lints the tree and rolls it reproducibly:

tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
    --mtime=@$SOURCE_DATE_EPOCH \
    --use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
    -cf gdal-3.13.3-3.tar.xz -C "$PKG" .

5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/gdal, and runs the triggers its paths call for.

Contents

Installed programs: gdal, gdal-config, gdal2tiles, gdal2tiles.py, gdal2xyz, gdal2xyz.py, gdal_calc, gdal_calc.py, gdal_contour, gdal_create, gdal_edit, gdal_edit.py, gdal_fillnodata, gdal_fillnodata.py, gdal_footprint, gdal_grid, gdal_merge, gdal_merge.py, gdal_pansharpen, gdal_pansharpen.py, gdal_polygonize, gdal_polygonize.py, gdal_proximity, gdal_proximity.py, gdal_rasterize, gdal_retile, gdal_retile.py, gdal_sieve, gdal_sieve.py, gdal_translate, gdal_viewshed, gdaladdo, gdalattachpct, gdalattachpct.py, gdalbuildvrt, gdalcompare, gdalcompare.py, gdaldem, gdalenhance, gdalinfo, gdallocationinfo, gdalmanage, gdalmdiminfo, gdalmdimtranslate, gdalmove, gdalmove.py, gdalsrsinfo, gdaltindex, gdaltransform, gdalwarp, gnmanalyse, gnmmanage, nearblack, ogr2ogr, ogr_layer_algebra, ogr_layer_algebra.py, ogrinfo, ogrlineref, ogrmerge, ogrmerge.py, ogrtindex, pct2rgb, pct2rgb.py, rgb2pct, rgb2pct.py, sozip.

Installed libraries: libgdal.so.

Installed directories: /usr/lib/cmake/gdal, /usr/lib/gdalplugins, /usr/lib/python3.14/site-packages/GDAL-3.13.3-py3.14.egg-info, /usr/lib/python3.14/site-packages/osgeo, /usr/lib/python3.14/site-packages/osgeo_utils, /usr/share/gdal, /usr/share/licenses/gdal.

Short descriptions

gdal Main gdal entry point Added in version 3.11.
gdal-config Determines various information about a GDAL installation. Determines various information about a GDAL installation.
gdal2tiles Generates directory with TMS tiles, KMLs and simple web viewers.
gdal_calc Command line raster calculator with numpy syntax.
gdal_contour Builds vector contour lines from a raster elevation model.
gdal_create Create a raster file (without source dataset)
gdal_edit Edit in place various information of an existing GDAL dataset.
gdal_fillnodata Fill raster regions by interpolation from edges.
gdal_footprint Compute footprint of a raster.
gdal_grid Creates regular grid from the scattered data.
gdal_merge Mosaics a set of images.
gdal_pansharpen Perform a pansharpen operation.
gdal_polygonize Produces a polygon feature layer from a raster.
gdal_proximity Produces a raster proximity map.
gdal_rasterize Burns vector geometries into a raster.
gdal_retile Retiles a set of tiles and/or build tiled pyramid levels.
gdal_sieve Removes small raster polygons.
gdal_translate Converts raster data between different formats.
gdal_viewshed Calculates a viewshed raster from an input raster DEM for a user defined point
gdaladdo Builds or rebuilds overview images.
gdalbuildvrt Builds a VRT from a list of datasets.
gdalcompare Compare two images.
gdaldem Tools to analyze and visualize DEMs.
gdalinfo Lists various information about a GDAL supported raster dataset
gdallocationinfo Raster query tool.
gdalmanage Identify, delete, rename and copy raster data files.
gdalmdiminfo Reports structure and content of a multidimensional dataset
gdalmdimtranslate Converts multidimensional data between different formats, and perform subsetting.
gdalmove Transform georeferencing of raster file in place.
gdalsrsinfo Lists info about a given SRS in number of formats (WKT, PROJ.4, etc.)
gdaltindex Builds a shapefile as a raster tileindex.
gdaltransform Transforms coordinates.
gdalwarp Image reprojection and warping utility.
gnmanalyse Analyses networks
gnmmanage Manages networks
nearblack Convert nearly black/white borders to black.
ogr2ogr Converts simple features data between file formats.
ogr_layer_algebra Performs various Vector layer algebraic operations Added in version 3.6.
ogrinfo Lists information about an OGR-supported data source.
ogrlineref Create linear reference and provide some calculations using it.
ogrmerge Merge several vector datasets into a single one.
ogrtindex Creates a tileindex.
pct2rgb Convert an 8bit paletted image to 24bit RGB.
rgb2pct Convert a 24bit RGB image to 8bit paletted.
sozip Generate a seek-optimized (SOZip) file. Added in version 3.7.
gdal.pc Geospatial Data Abstraction Library

Notes

The osgeo.gdal_array module, which gdal_calc.py and most raster scripting import, is built only when CMake finds numpy, and GDAL leaves it out without an error when it does not. build.sh therefore checks that _gdal_array*.so is in the package and fails the build when it is not.

libgeotiff is a port, but GDAL_USE_GEOTIFF is not named, so under GDAL_USE_EXTERNAL_LIBS=OFF GDAL builds its own copy of libgeotiff into the library.