When composed with multiscales, disallow spatial:transform at top level; require it on all layout items#15
Conversation
layout itemsmultiscales, disallow spatial:transform at top level; require it on all layout items
| "properties": { | ||
| "multiscales": { | ||
| "required": ["layout"] | ||
| } | ||
| }, | ||
| "required": ["multiscales"] |
There was a problem hiding this comment.
We could change this to look for the specific multiscales uuid instead of the fields multiscales and layout, though above it hard-codes multiscales and layout as keys anyways
|
Just make transform and shape required everywhere. It doesn't hurt to be explicit, and it's tiny. |
emmanuelmathot
left a comment
There was a problem hiding this comment.
Clean, well-scoped change. if/then plus required on layout items reads correctly, and asserting invalid examples are rejected is a nice addition. A few notes:
spatial:shapeasymmetry. Forbidden at root but notrequiredon layout items either, so it can vanish entirely. Intentional (derivable from the array shape) or oversight? Should mirrorspatial:transformif it's normative.- README not updated. Existing prose still says these properties "can be added to layout items" / "placed at root", which doesn't reflect the new normative rule.
dem-multiresolution-partial.jsonviolates two rules at once (missing on some items and root-level present), so it doesn't independently exercise the "missing on some items" branch. Inline fix below.- Will conflict with #24 (removes the 2D/3D
oneOfarms); easiest to rebase after that lands.
| "multiscales": { | ||
| "type": "object", | ||
| "description": "When composing with multiscales convention, spatial: properties can be added to layout items", | ||
| "description": "When composing with multiscales convention, spatial: properties must be added to every layout item. spatial:transform is required on all layout items to unambiguously define the coordinate transformation for each resolution level.", |
There was a problem hiding this comment.
Only spatial:transform is actually required on every layout item, not spatial: properties generally:
| "description": "When composing with multiscales convention, spatial: properties must be added to every layout item. spatial:transform is required on all layout items to unambiguously define the coordinate transformation for each resolution level.", | |
| "description": "When composing with the multiscales convention, `spatial:transform` is required on every layout item to unambiguously define the coordinate transformation for each resolution level. `spatial:transform` and `spatial:shape` must not appear at the root attributes level in this case.", |
| "spatial:transform": { | ||
| "type": "array", | ||
| "description": "Transform override for this resolution level", | ||
| "description": "Affine transform for this resolution level mapping array indices to coordinates. Required on every layout item when using multiscales with this convention.", |
There was a problem hiding this comment.
required below is unconditional inside layout items, so the qualifier is misleading:
| "description": "Affine transform for this resolution level mapping array indices to coordinates. Required on every layout item when using multiscales with this convention.", | |
| "description": "Affine transform for this resolution level, mapping array indices to coordinates. Required on every layout item.", |
| "spatial:transform": [ | ||
| 0.000277778, | ||
| 0.0, | ||
| -180.0, | ||
| 0.0, | ||
| -0.000277778, | ||
| 90.0 | ||
| ], |
There was a problem hiding this comment.
Drop the root-level spatial:transform so this isolates the "missing on some items" violation:
| "spatial:transform": [ | |
| 0.000277778, | |
| 0.0, | |
| -180.0, | |
| 0.0, | |
| -0.000277778, | |
| 90.0 | |
| ], |
Closes #12
Schema changes
multiscales.layoutexists, thenspatial:transformmust not exist at the top levelmultiscales.layoutexists, thenspatial:shapemust not exist at the top levelmultiscales.layoutexists, thenspatial:transformmust exist on all items withinlayoutChange list
sentinel2-tci.jsonis invalid because it doesn't have aspatial:transformon each item inlayout.dem-multiresolution.jsonis invalid because it has aspatial:transformat the top level.