PDOK geotiff-validator
The PDOK geotiff validator is used by PDOK. PDOK is part of the Dutch government. This geotiff validator is used to validate a set of requirements to make sure geotiffs adhere to our standardized ETL pipeline. It is possible to use this for your own purposes. The validations will not change (except for bugfixes); new validations are always added to the list.
Table of Contents
TL;DR Commands
Either run through docker or locally.
Docker
Validate a single GeoTiff file with the default set of validation rules:
geotiff_path=relative/path/to/the.tif
docker run -v "$(pwd)":/tiff --rm pdok/geotiff-validator validate --geotiff-path "/tiff/${geotiff_path}"
Validate a GeoTiff folder with the default set of validation rules:
geotiff_path=relative/path/to/the.tif
docker run -v "$(pwd)":/tiff --rm pdok/geotiff-validator validate --folder-path "/tiff/"
Generate definitions for a folder containing GeoTiffs:
geotiff_path=relative/path/to/the.tif
docker run -v "$(pwd)":/tiff --rm pdok/geotiff-validator generate-definitions --folder-path "/tiff/"
What does it do
The GeoTiff validator can validate Geotiff files (.tif files with GeoTiff extension) to see if they conform to a set of standards. The current checks are (see also the 'show-validations' command)
| Validation code | Description |
|---|---|
| 0 | The file must exist and be a valid GeoTiff |
| 1 | The GeoTiff must be a Cloud Optimized GeoTiff(COG) |
| 2 | The GeoTiff must be compressed with LZW |
| 3 | The GeoTiff must not have views |
| 4 | The GeoTiff must match the generated schema |
Note to PDOK developers: make sure to update the Kangaroo webinterface when adding a new validation.
Installation
This package requires:
- GDAL version == 3.11.5.
- And python >= 3.10 to run.
Docker Installation
Pull the latest version of the Docker image (only once needed, or after an update)
docker pull pdok/geotiff-validator:latest
Or build the Docker image from source:
docker build -t pdok/geotiff-validator .
The command is directly called so subcommands can be run in the container directly:
docker run -v ${PWD}:/tiff --rm pdok/geotiff-validator validate --definitions-path /path/to/schema_definitions.json --geotiff-path /tiff/tests/data/single_files/test_correct.tif
Usage
Validate
Usage: geotiff-validator validate [OPTIONS]
Geotiff validator validating one or more tiff files.
Options:
--geotiff-path FILE Path pointing to the geotiff .tif file [env
var: GEOTIFF_PATH]
--folder-path DIRECTORY Path pointing to a folder containing geotiff
.tif files [env var: FOLDER_PATH]
--definitions-path FILE Path pointing to the geotiff-definitions
JSON or YAML file (generate this file by
calling the generate-definitions command)
--required-validations TEXT Comma-separated list of validations to run
(e.g. --required-validations 1,2,3). If
validations-path, required-validations and
recommended-validations are not given,
validate runs all validations [env var:
REQUIRED_VALIDATIONS]
--recommended-validations TEXT Comma-separated list of validations to run
(e.g. --recommended-validations 1,2,3). If
validations-path, required-validations and
recommended-validations are not given,
validate runs all validations [env var:
RECOMMENDED_VALIDATIONS]
--validations-path TEXT Path pointing to the set of validations to
run. If validations-path, required-
validations and recommended-validations are
not given, validate runs all validations
[env var: VALIDATIONS_PATH]
--exit-on-fail Exit with code 1 when validation success is
false.
--help Show this message and exit.
Schema validation
To validate schemas (validation #4) you have to generate definitions first.
docker run -v ${PWD}:/gpkg --rm pdok/geotiff-validator geotiff-validator generate-definitions --folder-path /mytifffolder
Show validations
Show all the possible validations that are executed in the validate command.
Usage: geotiff-validator show-validations [OPTIONS]
Show all the possible validations that can be executed in the validate
command.
Options:
--no-legacy Output without Legacy checks
--yaml Output yaml
-v, --verbosity LVL Either CRITICAL, ERROR, WARNING, INFO or DEBUG
--help Show this message and exit.
Generate schema definitions
Usage: geotiff-validator generate-definitions [OPTIONS]
Generate schema definition for one or multiple tifs . Use the
generated definition JSON or YAML in the validation step by providing the
table definitions with the --definitions-path parameter.
Options:
--folder-path DIRECTORY Path pointing to the folder containing the geotiff
files [env var: FOLDER_PATH]
--geotiff-path FILE Path pointing to the geotiff .tif file [env var:
GEOTIFF_PATH]
--help Show this message and exit.
Tests
Run the tests regularly.
pytest .
Releasing
Release in github by creating a new release in github.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pdok_geotiff_validator-0.0.4.tar.gz.
File metadata
- Download URL: pdok_geotiff_validator-0.0.4.tar.gz
- Upload date:
- Size: 19.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
41cd7c98e1cf5408cacee361397f76795adee6871c5cb8e8cf02dffa218fa512
|
|
| MD5 |
a38d10a603ceb65bdc0980128327bc47
|
|
| BLAKE2b-256 |
4af8f85cf813a609359dbc8ea1236092d415ee5cd7ae7bba257b01b57e7b8720
|
File details
Details for the file pdok_geotiff_validator-0.0.4-py3-none-any.whl.
File metadata
- Download URL: pdok_geotiff_validator-0.0.4-py3-none-any.whl
- Upload date:
- Size: 19.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c69e4140fa3b44d8a0b43ce360dbd3e96dd70fe190e3165c92b1f7a5c320d98
|
|
| MD5 |
1ce0ba8ec65cbbbf13ad7e9862a606b5
|
|
| BLAKE2b-256 |
782c12e885b7e24b1aae9fe0f681aa3b13dbdac518705f619cd5221294dc8aca
|