Skip to main content

PDOK geotiff-validator

TestsPyPI version

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

pdok_geotiff_validator-0.0.1.tar.gz (19.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pdok_geotiff_validator-0.0.1-py3-none-any.whl (19.6 kB view details)

Uploaded Python 3

File details

Details for the file pdok_geotiff_validator-0.0.1.tar.gz.

File metadata

  • Download URL: pdok_geotiff_validator-0.0.1.tar.gz
  • Upload date:
  • Size: 19.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for pdok_geotiff_validator-0.0.1.tar.gz
Algorithm Hash digest
SHA256 b3db9b9b014eacb97380d3b5c696c3e3c43c7618d7a8d4d04be5a43f39b4792a
MD5 e6a7e52ddfe8dda4fbefa3db43af28fb
BLAKE2b-256 f65eab8fa3606e46828a470215d3dd6ded3d0e587913ab2f4be887496275122a

See more details on using hashes here.

File details

Details for the file pdok_geotiff_validator-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pdok_geotiff_validator-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6f2da9bb5a9738d5af0fd6eba2f104e29db65bcbb98dd2c6dfc98e83065c5b9d
MD5 25a5cd7fab2371412e60a0a5b51cf9f3
BLAKE2b-256 f892c663f87964ecf3423812f2c91f9a652e5e8af4f4a0c2d630ce180672348f

See more details on using hashes here.

Release history Release notifications | RSS feed

0.0.4

2 files

0.0.3

2 files

0.0.2

2 files

This release

0.0.1 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page