THE GOLD STANDARD OF GEOINFORMATICS
A valid integer can name a land-cover class, combine several quality flags or mean nothing at all
A cloud-mask pixel contains the integer 6. One analyst reads it as class 6, another isolates two bits and obtains the flags cloud and cirrus, while a third treats it as a measured quantity. The file opens for all three. Only the metadata contract and a tested decoding rule reveal which interpretation is defensible.
The STAC Classification extension describes categorical classes and bitfields that give stored codes semantic meaning. It is about pixel or model-output classification, not security clearance. Its fields can be attached where the class contract is true, including an asset, an individual raster band, a machine-learning output or a Collection item-assets definition.
This guide builds two fictional fixtures: a single-code land-cover raster and a packed quality band. It checks value identity, bit offsets, nodata, names, descriptions, counts and percentages, then changes the class order and software path. The aim is a handoff that preserves meaning rather than merely preserving integers.
Begin with the Gold Standard of Geoinformatics, place this guide within the Gold Standard of Education, and use the How X Works hub to transfer the same evidence-first method to other systems.
Choose a reading route
Define the class contract
Chapters 1–3. Separate class codes, names, nodata and bitfields.
Decode and test
Chapters 4–6. Work bits, counts, percentages and attachment scope.
Transfer safely
Chapters 7–9. Protect class identity through resampling, change and handoff.
Chapter contents
Foundations: Chapters 1–3
1. Separate categorical codes from measured quantities
2. Treat class identity as a stable key, not a display position
3. Keep nodata, unclassified and valid background separate
Working method: Chapters 4–6
4. Decode bitfields with offset, length and direction made explicit
5. Attach classification metadata at the level where it is true
6. Audit counts and percentages without treating them as ground truth
Transfer and handoff: Chapters 7–9
7. Protect categorical meaning during resampling and reprojection
8. Version class schemes and crosswalks without rewriting history
9. Hand over a classification receipt with bounded claims
Independent worked case · Comparison table · Practical questions · Continue reading
CHAPTER 1 OF 9
Separate categorical codes from measured quantities
Create a fictional one-band raster called land_cover. Its stored values are 1, 2, 3 and 255. The class contract maps 1 to water, 2 to vegetation and 3 to built surface; 255 is nodata. These numbers are identifiers inside a controlled vocabulary. Averaging 1 and 3 to obtain 2 does not produce evidence of vegetation.
A class code answers which category was assigned under a particular scheme. A continuous measurement answers how much of a quantity was observed. The two can share an integer datatype while requiring completely different operations. A histogram is meaningful for both, but its bins have different semantics and cannot be interpreted by datatype alone.
Keep a machine-readable name distinct from a human description. A name such as built_surface can remain stable across languages and display revisions, while the description can explain the training or mapping convention. Do not use a changing presentation label as the only identity of a class that appears in analytical rules.
Change the context to a habitat model whose codes are 10, 20 and 30. The numerical gaps still do not imply distance. A gold-standard workflow names the scheme, code-to-class mapping, nodata rule and product version before it calculates area, transition or agreement.
Practical evidence check
List every observed code from a small fixture, join it to the declared class object and reject any code that lacks a documented meaning. Confirm that nodata is excluded before class counts are computed.
CHAPTER 2 OF 9
Treat class identity as a stable key, not a display position
Suppose a legend originally lists water, vegetation and built surface in that order. A later interface sorts alphabetically. If downstream logic identifies classes by array position, the same stored code can acquire a different label without any file change. Match on the declared value or stable name rather than the position in a user interface.
Descriptions can improve comprehension but should not carry hidden analytical rules. If vegetation includes mangrove only under a specific product edition, record that edition or scheme reference explicitly. A reader should not infer the classification ontology from a short colour legend or from wording copied into a chart title.
Colour hints support consistent display, yet colour is not identity. Two products can use green for different classes, and a colour-blind-safe redesign can alter every swatch while leaving the data unchanged. Preserve the class value and name when styling changes, and treat colour as presentation metadata.
When merging catalogues, do not assume equal names mean equal definitions. water in a global product may include seasonal wetlands that another local scheme labels separately. Preserve source scheme, version and mapping decisions so a crosswalk remains reviewable.
Practical evidence check
Reorder the displayed legend and change all colours. The class totals and analytical selections must remain identical. If they change, replace positional or colour-based joins with value-and-scheme keys.
CHAPTER 3 OF 9
Keep nodata, unclassified and valid background separate
Nodata means the product does not supply a usable class at that location under its contract. Unclassified can be a valid class stating that an observation was evaluated but not assigned to a listed category. Background can be a deliberate class outside the region of interest. Collapsing all three into zero destroys different evidence states.
The Classification extension permits a class object to identify nodata, while raster validity metadata and file masks may also describe eligibility. Reconcile these layers rather than guessing that the largest code or zero is invalid. A class value can be zero and still be an intentional category.
A count or percentage attached to a class must use a stated denominator. Ten cloud pixels out of one hundred valid pixels is 10 percent; ten out of one hundred and twenty total grid cells is 8.33 percent. Both calculations can be correct answers to different questions, so the denominator belongs in the evidence record.
Change the fixture so 255 means unclassified rather than nodata and validity is supplied by a separate mask. The stored values are unchanged, but the eligible population and class totals change. This demonstrates why code appearance cannot replace the declared contract.
Practical evidence check
Build a four-row ledger for valid class, unclassified, background and nodata. Record eligibility, inclusion in the denominator and display treatment separately. Test zero and the maximum integer explicitly.
CHAPTER 4 OF 9
Decode bitfields with offset, length and direction made explicit
A packed quality byte can store several flags. Use the fictional value 22, whose binary form is 00010110. Reading bits from right to left with the rightmost bit at offset zero, isolate the two-bit field at offset one: shifting right by one gives 00001011, and masking with binary 11 yields 3.
The isolated value 3 then maps through that bitfield’s class list. It does not mean class 22 and it does not inherit the class list of a neighbouring field. Each field needs its own offset, length and value mapping. Overlapping fields require a documented reason; accidental overlap makes two meanings depend on the same bits.
Write the operation as isolated equals stored shifted right by offset, then bitwise AND with two-to-the-length minus one. Parentheses matter in code, as do integer width and signedness. A negative signed byte can be promoted with leading ones unless it is converted to the intended unsigned representation before shifting.
Change the context from an eight-bit byte to a sixteen-bit quality word. The method survives, but the valid offsets, mask width and endianness of byte assembly must be verified from the file format and reader. The extension describes semantic bit positions, not every storage-layer detail.
Practical evidence check
Calculate two packed examples by hand, including value 22 at offset 1 and length 2. Run the production decoder and require the isolated values and mapped labels to match exactly.
CHAPTER 5 OF 9
Attach classification metadata at the level where it is true
A single-band asset can carry one class definition at asset level. A multiband raster may need separate classification metadata for each band because one band could contain land cover and another quality flags. Placing one combined class list on the asset invites a client to apply the wrong vocabulary to a band.
Collection item-assets definitions can state a common contract for child Items, but an individual Item may differ or use a later scheme. Compare the Item and resolved asset before assuming the Collection template is exact. A schema-valid catalogue can still contain an operational exception that matters to analysis.
Machine-learning model outputs can also declare classes, yet a model’s output index is not automatically the same as a training dataset label ID. Record the output contract actually produced by the model. If a post-processing step merges classes, publish the resulting mapping rather than the pre-merge vocabulary.
Scope affects discoverability and inheritance. Put metadata where a client can find it and where it remains true, but avoid duplicating divergent copies. When duplication is necessary for compatibility, validate that the copies agree as part of release testing.
Practical evidence check
For each class object, write the exact Item, asset, band or model output it governs. Introduce a second band with a different scheme and verify that a client cannot silently reuse the first band’s classes.
CHAPTER 6 OF 9
Audit counts and percentages without treating them as ground truth
Class objects can report count and percentage summaries. These are useful for discovery and quick checks, but they depend on the product’s eligible population, spatial extent, resolution and processing version. Recompute them from the referenced asset when they drive a consequential conclusion.
For a 4 by 4 valid fixture with eight water, four vegetation and four built cells, the counts sum to 16 and percentages to 100. Add four nodata border cells without changing the valid classes. Percentages remain 50, 25 and 25 only if the denominator is valid cells; a total-grid denominator produces 40, 20 and 20.
Rounding can make displayed percentages sum to 99 or 101. That alone is not corruption. Preserve unrounded counts and denominator so the display can be reproduced. A much larger discrepancy calls for checking nodata, overlaps, multi-label classes or a stale summary.
A catalogue summary is not an accuracy assessment. Perfectly consistent counts can describe a systematically misclassified map. Keep internal consistency, reference-data validation and fitness for use as separate gates.
Practical evidence check
Recompute counts from a tiny known raster and test both possible denominators. Record the rounding rule and explain any residual. Do not accept totals merely because they sum neatly.
CHAPTER 7 OF 9
Protect categorical meaning during resampling and reprojection
Nearest-neighbour selection usually preserves existing class codes during a grid transformation. Bilinear or cubic interpolation can create numerical values that were never declared as classes. A result containing 1.7 may be mathematically smooth but semantically invalid for a single-label land-cover scheme.
Even nearest-neighbour resampling can change class area at boundaries because the target grid samples different locations. Compare class counts and mapped area before and after reprojection, especially for narrow features and minority classes. Code preservation does not guarantee quantity preservation.
For bitfields, any interpolation is especially dangerous because each bit has independent meaning. Resample the decoded flags under an explicit rule or preserve the packed source grid. If a derivative repacks fields, publish its new bitfield contract and do not retain stale offsets.
Change the context to a probability raster rather than a hard class map. Probabilities are continuous values and can support different resampling choices, but selecting the final class afterward is a separate operation. The representation determines the valid transformation.
Practical evidence check
Reproject a three-class fixture with nearest and bilinear methods. Reject outputs containing undeclared codes, then compare class areas to expose changes that code validation alone cannot find.
CHAPTER 8 OF 9
Version class schemes and crosswalks without rewriting history
A provider may split vegetation into forest and low vegetation, merge two cloud states or correct a class description. Reusing the same scheme identifier without a version makes historical comparisons ambiguous. Preserve the vocabulary used by each asset and publish a new scheme edition when meanings change.
A crosswalk is an analytical assertion, not a rename. Mapping two source classes into one target class may be deterministic, while splitting one source class across two targets requires additional evidence. Mark one-to-many mappings as unresolved or model-based rather than assigning certainty that the source does not contain.
Keep original codes alongside harmonised codes. A recipient should be able to reproduce a published aggregate and return to the source classification. Overwriting the source field with a new common code removes the evidence needed to diagnose disagreements.
Change the context to multilingual display labels. Translation can improve access without changing the stable machine name or value. Review translations for domain meaning, but keep them as presentation layers linked to the same class identity.
Practical evidence check
Create a versioned crosswalk table with source scheme, source value, target scheme, target value, mapping type and rationale. Require explicit treatment for unmapped and one-to-many cases.
CHAPTER 9 OF 9
Hand over a classification receipt with bounded claims
A useful receipt identifies the STAC Item, asset, band or model output, extension version, scheme version, class and bitfield definitions, nodata and validity rules, counts, denominator, decoding code and any resampling or crosswalk. Include a checksum or stable resource identity when byte identity matters.
Add small fixtures with expected outputs: ordinary classes, zero, nodata, an unknown code and packed values that exercise every field. A recipient should be able to run them without the full dataset. Unknown codes must fail visibly or enter a named quarantine path rather than acquiring a default label.
State the limits. Passing the receipt verifies that codes were interpreted under the declared contract. It does not establish thematic accuracy, fairness of a model, adequate training data, currentness or suitability for a legal boundary decision. Those need separate evidence.
Transfer the method to survey response codes or medical-image masks. The domain changes, but the control remains: preserve the code system, decode packed representations correctly, distinguish missingness from categories and test the next reader with known cases.
Practical evidence check
Give the receipt to a reviewer who did not build the pipeline. They must decode every fixture, identify the denominator and state two claims that the classification check does not establish.
Previous: Chapter 8 · Contents · Next: Independent worked case
Evidence laboratory: how to test a categorical product before release
Begin with a value inventory rather than a colourful map. Read a bounded fixture and list each distinct stored code, its count and its declared status. Join that inventory to the class definitions using the numeric value and scheme identity. An attractive legend can conceal an unknown code, while a plain inventory makes the omission visible before it reaches an area calculation.
Next separate the three questions that are often collapsed: is the pixel present, is it eligible, and which class was assigned? A file mask can answer presence, a quality flag can answer eligibility and the classification band can answer category. Record the sequence. If a pipeline assigns a class before applying the eligibility mask, the class totals can include observations the product says not to use.
Exercise every bitfield independently. Construct packed values that set no bits, only the first field, only the last field and all fields. The test should compare both the isolated integer and the final class name. This catches offset mistakes that happen to produce a valid label and therefore escape a simple vocabulary check.
Test integer width at the software boundary. A byte with its highest bit set may enter one library as unsigned 128 and another as signed -128. Convert to the documented unsigned width before shifting, and retain the original stored value in the diagnostic record. A correct-looking low-order flag is not enough if higher fields were destroyed by sign extension.
Audit summaries against the spatial subset actually delivered. Recompute counts after clipping, reprojection and validity filtering. If the catalogue percentage describes the parent scene, label it as a parent summary rather than copying it onto the subset. A recipient should not mistake an unchanged metadata number for a statistic calculated from the derivative.
Run a change test with two scheme editions. Keep a small area whose source code is unchanged but whose definition was revised. The workflow must identify the semantic version difference even though raster subtraction returns zero. Numerical equality cannot prove categorical comparability when the vocabulary changed.
Finally test failure behaviour. Supply an unknown code, an overlapping bitfield and a class list with duplicate values. The release process should stop or quarantine the record with a useful message. Silent fallback to other, background or the first class converts a metadata problem into a false scientific claim.
Document the spatial support behind every class total. A pixel-centre assignment, a majority-area label and a vector polygon rasterised onto the same grid can produce identical codes at many cells while disagreeing along boundaries. Record how the class was generated, the source resolution and any minimum-mapping-unit rule. When area matters, use the appropriate pixel-area model for the coordinate system rather than multiplying count by a convenient nominal resolution everywhere.
Add an agreement fixture with two analysts or two models and compute a confusion table using stable class values. Overall agreement can be high while a rare class performs poorly, and a remapped vocabulary can create apparent disagreement that is actually a crosswalk problem. Keep semantic alignment, positional alignment and accuracy assessment as separate checks. The classification extension helps preserve the label contract; it does not choose reference data or decide which disagreement is acceptable. Make that boundary visible in every downstream report and review.
Previous: Chapter 9 · Contents · Next: Independent worked case
Independent worked case: one land-cover band and one packed quality band
Step 1
Use a fictional 3 by 3 land-cover raster with values 1, 1, 2, 2, 2, 3, 3, 255 and 0. The contract says 1 water, 2 vegetation, 3 built surface, 0 background and 255 nodata. Background is valid for display but excluded from the study-area denominator; nodata is invalid.
Step 2
Within the study area there are two water, three vegetation and two built cells: seven eligible classified cells. The percentages are 28.57, 42.86 and 28.57 after rounding to two decimals. Including background changes the question, while including nodata makes the denominator wrong.
Step 3
Pair it with quality bytes 0, 2, 6 and 22. Define a two-bit cloud-confidence field at offset one. Isolated values are 0, 1, 3 and 3. Map them to none, low, medium and high under that field’s own class list; the last two bytes therefore share high confidence even though their other bits differ.
Step 4
Now reverse the display order of the land-cover legend and translate the labels. Counts must not change. Then change 255 from nodata to an unclassified valid category in a new scheme version. The denominator and report must change because the meaning changed, not because the bytes changed.
Step 5
Finally reproject with bilinear interpolation and observe undeclared fractional codes. Reject that derivative for the hard-class band. Reproject with nearest-neighbour, then compare class areas and preserve the source grid and method in the receipt.
What each field can and cannot establish
Use this table as a pre-analysis gate. It separates helpful discovery metadata from the stronger evidence needed for a defensible interpretation.
| Field or object | What it describes | Evidence duty |
|---|---|---|
| Class value | One declared category | Match value and scheme; do not average identifiers |
| Bitfield | Several meanings packed into bits | Use offset and length, then map the isolated value |
| Nodata | No usable class under the contract | Exclude before counts and percentages |
| Unclassified | Valid observation without an assigned listed class | Keep separate from missingness |
| Colour hint | Presentation aid | Never use as the class key |
Previous: Independent worked case · Contents · Next: Practical questions
Practical questions and evidence checks
Is classification about confidential data?
No. In this extension, classification gives semantic meaning to coded pixel or model-output values. It is unrelated to security classification.
Can zero be a real class?
Yes. Zero can be a valid category, background, unclassified or nodata depending on the declared contract. Test it rather than guessing.
Why are bit offsets read from the right?
The extension defines the first, rightmost bit as offset zero. Isolate the documented field before applying its class mapping.
May I average class codes?
Not as a measurement. Class values are identifiers unless a separate ordered or quantitative meaning is explicitly defined.
Do percentages prove accuracy?
No. They can check internal summaries, but thematic accuracy requires comparison with appropriate reference evidence.
Which resampling method is safe?
Nearest-neighbour preserves existing codes, but can still change mapped area at boundaries. Validate both codes and quantities.
Can two schemes share the same class names?
They can, but equal labels do not prove equal definitions. Keep scheme and version with every mapping.
What is the minimum handoff?
Identify scope, scheme, classes or bitfields, validity rules, fixtures, transformations, resource identity and explicit limits.
A compact release gate
- Identify the exact STAC Item, asset, band or variable and extension version.
- Reconcile the catalogue fields with the file and authoritative product documentation.
- Run ordinary, boundary, missing and deliberately changed fixtures through the production reader.
- Record every transformation, unit conversion, selection rule and version that affects meaning.
- Give the receipt to another reader and require the expected values, locations and limits to survive.
Previous: Comparison table · Contents · Next: Continue reading
Continue through the verified ecosystem
Return to the Geoinformatics subject root, the Gold Standard education parent, or the How X Works hub. The following specialist routes extend the evidence chain without inventing sibling pages.
Choose the correct STAC asset before decoding classes — separate previews and support files from measurement-ready inputs.
Preserve zero and validity correctly — distinguish real zero, nodata, masks and the denominator used by a class summary.
Decode stored raster values before interpreting them — keep scale, offset, units and categorical codes in their proper domains.
Protect land-cover classes during resampling — see why interpolating class identifiers invents unsupported categories.
Verify the bytes behind the class contract — confirm that the decoded resource is the file described by the catalogue.
Authoritative sources
Specifications and official technical documentation establish field meanings and current contracts. The worked fixtures and transfer checks in this guide are original teaching examples.
STAC Classification Extension — official specification or technical documentation.
STAC Raster Extension — official specification or technical documentation.
OGC STAC Community Standard 1.1 — official specification or technical documentation.
GDAL Raster Data Model masks — official specification or technical documentation.
The transfer test
A workflow reaches the gold standard when another careful reader can open the same resource, locate the same measurement, reproduce the same decoding and checks, and explain where the conclusion stops. Passing one file is useful; preserving that reasoning when the sensor, grid, software or decision changes is the real test.
Explore the full Gold Standard of Geoinformatics · Explore more How X Works guides.
