E4 ยท Publication Volume 26
Raster Operations
resampling, reprojection, map algebra, filters and edge effects
Learning objectives
- Explain the decision and evidence boundary for resampling, reprojection, map algebra, filters and edge effects.
- Select and implement the relevant representation or algorithm without hidden coordinate, support or topology assumptions.
- Separate exact predicates, approximation error, source uncertainty and visual delivery.
- Produce a support-aware raster operation pipeline with conservation checks from synthetic evidence.
The lesson is complete only when the learner can defend the representation, transform, predicates, tests and release decision. A visually clean map or 3D scene without executable invariants and provenance remains unverified.
This is a general, institution-neutral tutorial with no relationship to any company or individual. All coordinates, geometries, grids, points, surfaces, volumes, attributes and review events in the lesson are synthetic and must not be used for an operational decision.
Decision context
The decision is which output grid and value estimator answer the intended question. Reprojection defines a geometric mapping, while resampling estimates values on a new support; combining them does not make either choice neutral. Categorical labels, continuous fields, counts, probabilities, directions and conserved totals require different estimators. The workflow declares target reference, extent, resolution, alignment, kernel, mask rule, edge rule, value domain and whether conservation or extrema preservation is required.
Write the intended use, consequence of error, required evidence, spatial support and release authority before selecting a representation or transformation. Fitness is evaluated against a versioned contract and use, not attached permanently to a file extension.
Core concept
Nearest-neighbour sampling selects a source value and is often suitable for categories, but it can create blocky boundaries. Bilinear and higher-order interpolation blend continuous samples, but they invent intermediate values and can cross barriers. Area-weighted aggregation can preserve averages or totals when support changes, provided the quantity semantics are correct. A filter has a footprint and boundary condition; output near the edge may depend on padding, reflection, truncation or missing-neighbour policy. Map algebra is valid only after grids and value states are aligned.
Keep received evidence, accepted analytical views and derived representations as distinct objects. This allows corrected evidence, a changed transform or a new level of detail to generate a new result without rewriting history. Every coordinate and primitive therefore answers both a spatial question and a provenance question.
Algorithm and data model
Separate output-grid construction, inverse coordinate mapping, source-window selection, kernel evaluation, mask propagation, value-domain checks and output encoding. Use inverse mapping from output cell locations to source space to avoid holes, then record the exact transform chain. For weighted continuous estimates, renormalise weights over valid contributors only when that rule is scientifically justified; otherwise mark the result missing. For categorical data, record tie policy and never interpolate numeric category codes. Preserve a validity or coverage fraction beside each aggregated output when partial support matters.
Define parsing, semantic validation, canonicalisation, indexing, exact or approximate calculation, quality evaluation and encoding as separate stages. Each stage emits structured output and does not depend on interface state, file order, graphics-driver behaviour or undocumented defaults.
Constraints and invariants
| Invariant | Executable or review test | | --- | --- | | The output grid and resampling estimator are declared before execution. | Reject or quarantine the exact affected object and preserve the received representation. | | Kernel choice follows value semantics rather than storage data type alone. | Evaluate this condition before creating a derived geometry, grid, surface or volume. | | Masks, coverage and edge policy are propagated into every output value. | Record the predicate, tolerance policy, observed values and coordinate frame. | | Conservation or extrema checks are evaluated for the quantity they govern. | Make every repair a new version and rerun all dependent golden cases. |
An invariant must survive import, transformation, processing, export and rerun. A failed hard invariant produces no apparently valid substitute. Diagnostics remain visible with predicate, threshold, coordinate frame, scope and evidence, and require a reviewed rule before they can trigger repair.
Quantitative reasoning
A weighted estimate is z^*=\sum_i w_i z_i/\sum_i w_i over contributors admitted by the mask rule. Report contributing support, weight sum, valid fraction, source and target cell areas, minimum and maximum before and after, and total or mean conservation according to quantity semantics. For extensive quantity Q, compare \Delta_Q=(Q_{out}-Q_{in})/Q_{in} over matched extent. For categories report a confusion table against a high-resolution reference rather than root-mean-square error. Test identity warps, integer translations, half-cell translations, rotations, all-missing windows, single valid contributors and boundaries with each padding policy.
Every metric includes units, support, numerator and denominator where applicable, exclusions, comparison policy and evaluation version. Aggregate metrics are stratified when pooling can hide local geometry failure. A performance gain cannot overrule invalid topology, missing reference metadata or broken lineage.
Evidence and uncertainty
Keep acquisition uncertainty, interpretation uncertainty, discretisation error, numeric round-off and delivery error separate. Increasing coordinate digits or triangle count does not improve the original evidence. A sampled surface may be smooth and watertight while remaining poorly constrained between observations. Report uncertainty in the quantity and support to which it belongs.
Build an evidence packet containing immutable received objects, semantic declarations, validation findings, transform inputs and outputs, measured errors, test results, reviewer decisions and fingerprints. Contradictory evidence remains available. When a required reference, topology state or classification cannot be resolved, return unknown, conflict or blocked rather than inventing geometry.
Interfaces and storage
Interfaces transmit identity, coordinate reference, units, axis order, support, topology expectations, attribute association, null state, version and lineage beside coordinates. Structured errors identify the object, primitive, predicate, observed value, expected condition and rule. An interface that carries vertices but drops the transform or face orientation has not preserved the object.
Store authoritative received evidence separately from reproducible analytical derivatives and disposable delivery artefacts. Indexes, caches, pyramids and render meshes improve access but cannot become the only copy of source attributes or coordinate metadata. Round-trip tests verify identity, precision, topology, ordering, missingness and association after encoding changes.
Governance and review
Assign responsibilities to roles rather than named organisations or people: evidence custodian, representation author, algorithm maintainer, independent validator and release reviewer. A role may propose a repair but cannot erase the received geometry. Transform, predicate and tolerance changes are versioned and evaluated against fixed regression fixtures before release.
Exceptions are explicit decisions with scope, rationale, evidence, approving role, affected versions and review trigger. They never turn invalid topology into valid topology by label. The host website has no ownership or scientific-authority role in this workflow; it only delivers the tutorial.
Integration checkpoint
Read the figure as a reasoning map from preserved evidence through declared support and coordinates, controlled transformation, validation and scoped release. Each arrow represents a declared relationship. Integrate a support-aware raster operation pipeline with conservation checks into SYN-SPATIAL, rerun earlier fixtures and record every changed assumption.
Synthetic worked example
Synthetic raster SYN-R03 stores three geological classes as integer codes, while SYN-R04 stores a continuous synthetic elevation field. Applying bilinear resampling to both creates impossible fractional class codes in SYN-R03. The corrected pipeline uses nearest-neighbour for the class raster and area-aware bilinear interpolation for the elevation derivative, propagates masks, and records coverage. An identity-warp fixture reproduces both sources exactly; a coarse-grid test reports class-area changes and elevation mean change separately instead of hiding them in one error score.
- Preserve the received object and state the intended decision without repair.
- Resolve identity, reference, units, support, topology and evidence eligibility.
- Run the versioned transform or predicate while retaining intermediate diagnostics.
- Issue accept, reject or quarantine and show how an independent reviewer reproduces it.
Practice task
Implement the chapter artefact against a synthetic fixture containing one normal case, one boundary case, one invalid case and one unresolved-evidence case. Preserve the received fixture. Produce canonical input, validation findings, derivative output, processing manifest, measured error and a short release decision.
Acceptance criteria:
- Every required identity, coordinate reference, unit, support and convention is explicit.
- The implementation is deterministic under stable ordering and the declared numerical policy.
- No repair overwrites received evidence or converts unknown into a guessed value.
- All hard failures block the affected derivative and remain machine-readable.
- A second implementation or reviewer can reproduce the result from the package alone.
Submit a support-aware raster operation pipeline with conservation checks, golden and adversarial fixtures, exact findings, measured error and a limitations note. A screenshot is not sufficient evidence because it does not identify input versions, transforms, algorithms or rule configuration.
Common failure modes
- Interpolating category codes because they are stored as integers.
- Allowing a library default to choose output extent or resolution.
- Renormalising over missing neighbours without declaring changed support.
- Ignoring edge padding while interpreting filtered anomalies.
These failures share a pattern: implicit convenience is substituted for evidence. Diagnose the earliest boundary where the assumption entered, restore the source statement, make the transform or predicate explicit, rerun all dependent derivatives and supersede rather than overwrite the affected release.
Review questions
- Why are reprojection and resampling different decisions?
- Which estimators suit categories, continuous fields and conserved totals?
- What should be reported when only part of an output cell has valid support?
- Which identity and boundary fixtures expose hidden defaults?
For every answer, identify the governing invariant, evidence needed to evaluate it, numerical or semantic policy involved and correct behaviour when the condition fails.
Sources and further reading
- GDAL Warp API tutorial, documenting reprojection, output-grid definition, resampling and masks.
- GDAL raster data model, documenting bands, affine geotransforms, pixel coordinates, masks and NoData.
- OGC GeoTIFF 1.1, specifying raster-to-model transformations and coordinate-reference metadata in TIFF.
- ISO 19157-1:2023 geographic data quality, providing a framework for describing and evaluating geographic-data quality.