Skip to main content

deriveRectangleAndScheme()

function deriveRectangleAndScheme(
crs,
xyLimits,
levelMetadata,
zarrArray,
dimIndices): object;

Computes a Cesium Rectangle and TilingScheme for a Zarr dataset.

Parameters

ParameterTypeDescription
crsCRSCRS code (EPSG:4326 or EPSG:3857). See CRS.
xyLimitsXYLimitsPropsMin/max X/Y values in the dataset's CRS. See XYLimitsProps.
levelMetadataMap<number, ZarrLevelMetadata>Per-resolution metadata (width/height).
zarrArrayArray<any>The Zarr array containing the data.
dimIndicesDimIndicesPropsMapping of dimension keys to their array indices. See DimIndicesProps.

Returns

object

{ rectangle, tilingScheme }

rectangle

rectangle: Rectangle;

tilingScheme

tilingScheme: TilingScheme;

Remarks

Behavior notes:

  • The rectangle is expanded by half a pixel in all directions to avoid edge clipping.
  • Pixel resolution is estimated from either levelMetadata.get(0) or the Zarr array shape.
  • For EPSG:3857, the function interprets xyLimits as Web Mercator meters and uses WebMercatorProjection.unproject to obtain geographic radians.
  • If any computation fails, the function falls back to a full-world tiling scheme (WebMercator or Geographic).
  • If latitude limits are reversed, they are swapped automatically.