Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions packages/deck.gl-raster/src/raster-layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,22 @@ export interface RasterLayerProps extends CompositeLayerProps {
*/
maxError?: number;

/**
* Minimum V (top edge) of the mesh in UV space [0, 1].
* Use to exclude rows at the top of the tile from meshing
* (e.g. when the tile touches lat +90° and the projection is undefined).
* @default 0
*/
_vMin?: number;

/**
* Maximum V (bottom edge) of the mesh in UV space [0, 1].
* Use to exclude rows at the bottom of the tile from meshing
* (e.g. when the tile touches lat -90° and the projection is undefined).
* @default 1
*/
_vMax?: number;

/** If set, enables debug mode for visualizing the mesh and reprojection process. */
debug?: boolean;

Expand Down Expand Up @@ -141,6 +157,8 @@ export class RasterLayer extends CompositeLayer<RasterLayerProps> {
height,
reprojectionFns,
maxError = DEFAULT_MAX_ERROR,
_vMin,
_vMax,
} = this.props;

// The mesh is lined up with the upper and left edges of the raster. So if
Expand All @@ -154,6 +172,7 @@ export class RasterLayer extends CompositeLayer<RasterLayerProps> {
reprojectionFns,
width + 1,
height + 1,
{ _vMin, _vMax },
);
reprojector.run(maxError);
const { indices, positions, texCoords } = reprojectorToMesh(reprojector);
Expand Down
13 changes: 8 additions & 5 deletions packages/raster-reproject/src/delatin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ export class RasterReprojector {
reprojectors: ReprojectionFns,
width: number,
height: number = width,
{ _vMin = 0, _vMax = 1 }: { _vMin?: number; _vMax?: number } = {},
) {
this.reprojectors = reprojectors;
this.width = width;
Expand All @@ -131,12 +132,14 @@ export class RasterReprojector {
this._pending = []; // triangles pending addition to queue
this._pendingLen = 0;

// The two initial triangles cover the entire input texture in UV space, so
// they range from [0, 0] to [1, 1] in u and v.
// The two initial triangles cover the input texture UV space.
// _vMin/_vMax allow callers to exclude rows at the top/bottom edges
// (e.g. to avoid polar singularities when the tile touches lat ±90°).
const u1 = 1;
const v1 = 1;
const p0 = this._addPoint(0, 0);
const p1 = this._addPoint(u1, 0);
const v0 = _vMin;
const v1 = _vMax;
const p0 = this._addPoint(0, v0);
const p1 = this._addPoint(u1, v0);
const p2 = this._addPoint(0, v1);
const p3 = this._addPoint(u1, v1);

Expand Down
Loading