@developmentseed/deck.gl-raster 0.1.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +80 -0
- package/dist/index.cjs +729 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +142 -0
- package/dist/index.d.ts +142 -0
- package/dist/index.js +723 -0
- package/dist/index.js.map +1 -0
- package/package.json +66 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/reprojection/index.ts","../src/reprojection/delatin.ts","../src/reprojection/affine.ts","../src/reprojection/geotiff-reprojection.ts"],"names":["a","b","e","t0","t1","d","proj4"],"mappings":";;;;;;;;;;;;;;;AAAA,IAAA,oBAAA,GAAA;AAAA,QAAA,CAAA,oBAAA,EAAA;AAAA,EAAA,iBAAA,EAAA,MAAA,iBAAA;AAAA,EAAA,MAAA,EAAA,MAAA,cAAA;AAAA,EAAA,0BAAA,EAAA,MAAA,0BAAA;AAAA,EAAA,gBAAA,EAAA,MAAA;AAAA,CAAA,CAAA;;;ACsBA,IAAM,aAAA,GAA4C;AAAA,EAChD,CAAC,CAAA,GAAI,CAAA,EAAG,CAAA,GAAI,CAAA,EAAG,IAAI,CAAC,CAAA;AAAA;AAAA,EACpB,CAAC,GAAA,EAAK,GAAA,EAAK,CAAC,CAAA;AAAA;AAAA,EACZ,CAAC,GAAA,EAAK,CAAA,EAAG,GAAG,CAAA;AAAA;AAAA,EACZ,CAAC,CAAA,EAAG,GAAA,EAAK,GAAG;AAAA;AACd,CAAA;AA4BO,IAAM,oBAAN,MAAwB;AAAA,EAC7B,YAAA;AAAA,EACA,KAAA;AAAA,EACA,MAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,GAAA;AAAA;AAAA;AAAA;AAAA,EAKA,oBAAA;AAAA;AAAA;AAAA;AAAA,EAKA,SAAA;AAAA,EAEQ,UAAA;AAAA;AAAA;AAAA;A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CAAA,qCAAA,EAAwC,GAAG,CAAA,CAAE,CAAA;AAAA,EAC/D;AACA,EAAA,MAAM,IAAA,GAAO,MAAM,QAAA,CAAS,IAAA,EAAK;AACjC,EAAA,OAAO,IAAA;AACT;AAYA,SAAS,oBACP,KAAA,EACkD;AAClD,EAAA,MAAM,MAAA,GAAS,MAAM,SAAA,EAAU;AAC/B,EAAA,MAAM,UAAA,GAAa,MAAM,aAAA,EAAc;AAMvC,EAAA,MAAM,aAAA,GAAgB,MAAM,gBAAA,EAAiB;AAC7C,EAAA,MAAM,sBAAsB,aAAA,CAAc,mBAAA;AAE1C,EAAA,IAAIL,EAAAA,GAAI,CAAA;AACR,EAAA,IAAII,EAAAA,GAAI,CAAA;AAER,EAAA,IAAI,mBAAA,IAAuB,mBAAA,CAAoB,MAAA,IAAU,EAAA,EAAI;AAM3D,IAAAJ,EAAAA,GAAI,oBAAoB,CAAC,CAAA;AACzB,IAAAI,EAAAA,GAAI,oBAAoB,CAAC,CAAA;AAAA,EAC3B;AAGA,EAAA,OAAO;AAAA,IACL,WAAW,CAAC,CAAA;AAAA;AAAA,IACZJ,EAAAA;AAAA;AAAA,IACA,OAAO,CAAC,CAAA;AAAA;AAAA,IACRI,EAAAA;AAAA;AAAA,IACA,WAAW,CAAC,CAAA;AAAA;AAAA,IACZ,OAAO,CAAC;AAAA;AAAA,GACV;AACF","file":"index.cjs","sourcesContent":["export { RasterReprojector } from \"./delatin.js\";\nexport type { ReprojectionFns } from \"./delatin.js\";\nexport * as affine from \"./affine.js\";\nexport {\n extractGeotiffReprojectors,\n fromGeoTransform,\n} from \"./geotiff-reprojection.js\";\n","/**\n * Define [**uv coordinates**](https://en.wikipedia.org/wiki/UV_mapping) as a float-valued image-local coordinate space where the top left is `(0, 0)` and the bottom right is `(1, 1)`.\n *\n * Define [**Barycentric coordinates**](https://en.wikipedia.org/wiki/Barycentric_coordinate_system) as float-valued triangle-local coordinates, represented as a 3-tuple of floats, where the tuple must add up to 1. The coordinate represents \"how close to each vertex\" a point in the interior of a triangle is. I.e. `(0, 0, 1)`, `(0, 1, 0)`, and `(1, 0, 0)` are all valid barycentric coordinates that define one of the three vertices. `(1/3, 1/3, 1/3)` represents the centroid of a triangle. `(1/2, 1/2, 0)` represents a point that is halfway between vertices `a` and `b` and has \"none\" of vertex `c`.\n *\n *\n * ## Changes\n *\n * - Delatin coordinates are in terms of pixel space whereas here we use uv space.\n *\n * Originally copied from https://github.com/mapbox/delatin under the ISC\n * license, then subject to further modifications.\n */\n\n/**\n * Barycentric sample points in uv space for where to sample reprojection\n * errors.\n */\n// TODO: Increase sampling density if uv area is large\n// Note: these sample points should never be an existing vertex (that is, no\n// vertex of a sample point should ever be `1`, such as `(0,0,1)`, because that\n// would try to sample exactly at an existing triangle vertex).\nconst SAMPLE_POINTS: [number, number, number][] = [\n [1 / 3, 1 / 3, 1 / 3], // centroid\n [0.5, 0.5, 0], // edge 0–1\n [0.5, 0, 0.5], // edge 0–2\n [0, 0.5, 0.5], // edge 1–2\n];\n\nexport interface ReprojectionFns {\n /**\n * Convert from UV coordinates to input CRS coordinates.\n *\n * This is the affine geotransform from the input image.\n */\n pixelToInputCRS(x: number, y: number): [number, number];\n\n /**\n * Convert from input CRS coordinates back to UV coordinates.\n *\n * Inverse of the affine geotransform from the input image.\n */\n inputCRSToPixel(x: number, y: number): [number, number];\n\n /**\n * Apply the forward projection from input CRS to output CRS.\n */\n forwardReproject(x: number, y: number): [number, number];\n\n /**\n * Apply the inverse projection from output CRS back to input CRS.\n */\n inverseReproject(x: number, y: number): [number, number];\n}\n\nexport class RasterReprojector {\n reprojectors: ReprojectionFns;\n width: number;\n height: number;\n\n /**\n * UV vertex coordinates (x, y), i.e.\n * [x0, y0, x1, y1, ...]\n *\n * These coordinates are floats that range from [0, 1] in both X and Y.\n */\n uvs: number[];\n\n /**\n * XY Positions in output CRS, computed via exact forward reprojection.\n */\n exactOutputPositions: number[];\n\n /**\n * triangle vertex indices\n */\n triangles: number[];\n\n private _halfedges: number[];\n\n /**\n * The UV texture coordinates of candidates found from\n * `findReprojectionCandidate`.\n *\n * Maybe in the future we'll want to store the barycentric coordinates instead\n * of just the uv coordinates?\n */\n private _candidatesUV: number[];\n private _queueIndices: number[];\n\n private _queue: number[];\n private _errors: number[];\n private _pending: number[];\n private _pendingLen: number;\n\n constructor(\n reprojectors: ReprojectionFns,\n width: number,\n height: number = width,\n ) {\n this.reprojectors = reprojectors;\n this.width = width;\n this.height = height;\n\n this.uvs = []; // vertex coordinates (x, y)\n this.exactOutputPositions = [];\n this.triangles = []; // mesh triangle indices\n\n // additional triangle data\n this._halfedges = [];\n this._candidatesUV = [];\n this._queueIndices = [];\n\n this._queue = []; // queue of added triangles\n this._errors = [];\n this._pending = []; // triangles pending addition to queue\n this._pendingLen = 0;\n\n // The two initial triangles cover the entire input texture in UV space, so\n // they range from [0, 0] to [1, 1] in u and v.\n const u1 = 1;\n const v1 = 1;\n const p0 = this._addPoint(0, 0);\n const p1 = this._addPoint(u1, 0);\n const p2 = this._addPoint(0, v1);\n const p3 = this._addPoint(u1, v1);\n\n // add initial two triangles\n const t0 = this._addTriangle(p3, p0, p2, -1, -1, -1);\n this._addTriangle(p0, p3, p1, t0, -1, -1);\n this._flush();\n }\n\n // refine the mesh until its maximum error gets below the given one\n run(maxError: number = 1): void {\n while (this.getMaxError() > maxError) {\n this.refine();\n }\n }\n\n // refine the mesh with a single point\n refine(): void {\n this._step();\n this._flush();\n }\n\n // max error of the current mesh\n getMaxError(): number {\n return this._errors[0]!;\n }\n\n // rasterize and queue all triangles that got added or updated in _step\n private _flush() {\n for (let i = 0; i < this._pendingLen; i++) {\n const t = this._pending[i]!;\n this._findReprojectionCandidate(t);\n }\n this._pendingLen = 0;\n }\n\n // Original, upstream implementation of FindCandidate:\n // // rasterize a triangle, find its max error, and queue it for processing\n // private _findCandidate(\n // p0x: number,\n // p0y: number,\n // p1x: number,\n // p1y: number,\n // p2x: number,\n // p2y: number,\n // t: number,\n // ) {\n // // triangle bounding box\n // const minX = Math.min(p0x, p1x, p2x);\n // const minY = Math.min(p0y, p1y, p2y);\n // const maxX = Math.max(p0x, p1x, p2x);\n // const maxY = Math.max(p0y, p1y, p2y);\n\n // // forward differencing variables\n // let w00 = orient(p1x, p1y, p2x, p2y, minX, minY);\n // let w01 = orient(p2x, p2y, p0x, p0y, minX, minY);\n // let w02 = orient(p0x, p0y, p1x, p1y, minX, minY);\n // const a01 = p1y - p0y;\n // const b01 = p0x - p1x;\n // const a12 = p2y - p1y;\n // const b12 = p1x - p2x;\n // const a20 = p0y - p2y;\n // const b20 = p2x - p0x;\n\n // // pre-multiplied z values at vertices\n // const a = orient(p0x, p0y, p1x, p1y, p2x, p2y);\n // const z0 = this.heightAt(p0x, p0y) / a;\n // const z1 = this.heightAt(p1x, p1y) / a;\n // const z2 = this.heightAt(p2x, p2y) / a;\n\n // // iterate over pixels in bounding box\n // let maxError = 0;\n // let mx = 0;\n // let my = 0;\n // for (let y = minY; y <= maxY; y++) {\n // // compute starting offset\n // let dx = 0;\n // if (w00 < 0 && a12 !== 0) {\n // dx = Math.max(dx, Math.floor(-w00 / a12));\n // }\n // if (w01 < 0 && a20 !== 0) {\n // dx = Math.max(dx, Math.floor(-w01 / a20));\n // }\n // if (w02 < 0 && a01 !== 0) {\n // dx = Math.max(dx, Math.floor(-w02 / a01));\n // }\n\n // let w0 = w00 + a12 * dx;\n // let w1 = w01 + a20 * dx;\n // let w2 = w02 + a01 * dx;\n\n // let wasInside = false;\n\n // for (let x = minX + dx; x <= maxX; x++) {\n // // check if inside triangle\n // if (w0 >= 0 && w1 >= 0 && w2 >= 0) {\n // wasInside = true;\n\n // // compute z using barycentric coordinates\n // const z = z0 * w0 + z1 * w1 + z2 * w2;\n // const dz = Math.abs(z - this.heightAt(x, y));\n // if (dz > maxError) {\n // maxError = dz;\n // mx = x;\n // my = y;\n // }\n // } else if (wasInside) {\n // break;\n // }\n\n // w0 += a12;\n // w1 += a20;\n // w2 += a01;\n // }\n\n // w00 += b12;\n // w01 += b20;\n // w02 += b01;\n // }\n\n // if (\n // (mx === p0x && my === p0y) ||\n // (mx === p1x && my === p1y) ||\n // (mx === p2x && my === p2y)\n // ) {\n // maxError = 0;\n // }\n\n // // update triangle metadata\n // this._candidatesUV[2 * t] = mx;\n // this._candidatesUV[2 * t + 1] = my;\n\n // // add triangle to priority queue\n // this._queuePush(t, maxError);\n // }\n\n /**\n * Conversion of upstream's `_findCandidate` for reprojection error handling.\n *\n * @param {number} t The index (into `this.triangles`) of the pending triangle to process.\n *\n * @return {void} Doesn't return; instead modifies internal state.\n */\n private _findReprojectionCandidate(t: number): void {\n // Find the three vertices of this triangle\n const a = 2 * this.triangles[t * 3 + 0]!;\n const b = 2 * this.triangles[t * 3 + 1]!;\n const c = 2 * this.triangles[t * 3 + 2]!;\n\n // Get the UV coordinates of each vertex\n const p0u = this.uvs[a]!;\n const p0v = this.uvs[a + 1]!;\n const p1u = this.uvs[b]!;\n const p1v = this.uvs[b + 1]!;\n const p2u = this.uvs[c]!;\n const p2v = this.uvs[c + 1]!;\n\n // Get the **known** output CRS positions of each vertex\n const out0x = this.exactOutputPositions[a]!;\n const out0y = this.exactOutputPositions[a + 1]!;\n const out1x = this.exactOutputPositions[b]!;\n const out1y = this.exactOutputPositions[b + 1]!;\n const out2x = this.exactOutputPositions[c]!;\n const out2y = this.exactOutputPositions[c + 1]!;\n\n // A running tally of the maximum pixel error of each of our candidate\n // points\n let maxError = 0;\n\n // The point in uv coordinates that produced the max error\n // Note that upstream also initializes the point of max error to [0, 0]\n let maxErrorU: number = 0;\n let maxErrorV: number = 0;\n\n // Recall that the sample point is in barycentric coordinates\n for (const samplePoint of SAMPLE_POINTS) {\n // Get the UV coordinates of the sample point\n const uvSampleU = barycentricMix(\n p0u,\n p1u,\n p2u,\n samplePoint[0],\n samplePoint[1],\n samplePoint[2],\n );\n const uvSampleV = barycentricMix(\n p0v,\n p1v,\n p2v,\n samplePoint[0],\n samplePoint[1],\n samplePoint[2],\n );\n\n // Get the output CRS coordinates of the sample point by bilinear\n // interpolation\n const outSampleX = barycentricMix(\n out0x,\n out1x,\n out2x,\n samplePoint[0],\n samplePoint[1],\n samplePoint[2],\n );\n const outSampleY = barycentricMix(\n out0y,\n out1y,\n out2y,\n samplePoint[0],\n samplePoint[1],\n samplePoint[2],\n );\n\n // Convert uv to pixel space\n const pixelExactX = uvSampleU * (this.width - 1);\n const pixelExactY = uvSampleV * (this.height - 1);\n\n // Reproject these linearly-interpolated coordinates **from target CRS\n // to input CRS**. This gives us the **exact position in input space**\n // of the linearly interpolated sample point in output space.\n const inputCRSSampled = this.reprojectors.inverseReproject(\n outSampleX,\n outSampleY,\n );\n\n // Find the pixel coordinates of the sampled point by using the inverse\n // geotransform.\n const pixelSampled = this.reprojectors.inputCRSToPixel(\n inputCRSSampled[0],\n inputCRSSampled[1],\n );\n\n // 4. error in pixel space\n const dx = pixelExactX - pixelSampled[0];\n const dy = pixelExactY - pixelSampled[1];\n const err = Math.hypot(dx, dy);\n\n if (err > maxError) {\n maxError = err;\n maxErrorU = uvSampleU;\n maxErrorV = uvSampleV;\n }\n }\n\n //////\n // Now we can resume with code from upstream's `_findCandidate` that\n // modifies the internal state of what triangles to subdivide.\n\n // Check that the max error point is not one of the existing triangle\n // vertices\n // TODO: perhaps we should use float precision epsilon here?\n if (\n (maxErrorU === p0u && maxErrorV === p0v) ||\n (maxErrorU === p1u && maxErrorV === p1v) ||\n (maxErrorU === p2u && maxErrorV === p2v)\n ) {\n maxError = 0;\n }\n\n // update triangle metadata\n this._candidatesUV[2 * t] = maxErrorU;\n this._candidatesUV[2 * t + 1] = maxErrorV;\n\n // add triangle to priority queue\n this._queuePush(t, maxError);\n }\n\n // process the next triangle in the queue, splitting it with a new point\n private _step(): void {\n // pop triangle with highest error from priority queue\n const t = this._queuePop();\n\n const e0 = t * 3 + 0;\n const e1 = t * 3 + 1;\n const e2 = t * 3 + 2;\n\n const p0 = this.triangles[e0]!;\n const p1 = this.triangles[e1]!;\n const p2 = this.triangles[e2]!;\n\n const au = this.uvs[2 * p0]!;\n const av = this.uvs[2 * p0 + 1]!;\n const bu = this.uvs[2 * p1]!;\n const bv = this.uvs[2 * p1 + 1]!;\n const cu = this.uvs[2 * p2]!;\n const cv = this.uvs[2 * p2 + 1]!;\n const pu = this._candidatesUV[2 * t]!;\n const pv = this._candidatesUV[2 * t + 1]!;\n\n const pn = this._addPoint(pu, pv);\n\n if (orient(au, av, bu, bv, pu, pv) === 0) {\n this._handleCollinear(pn, e0);\n } else if (orient(bu, bv, cu, cv, pu, pv) === 0) {\n this._handleCollinear(pn, e1);\n } else if (orient(cu, cv, au, av, pu, pv) === 0) {\n this._handleCollinear(pn, e2);\n } else {\n const h0 = this._halfedges[e0]!;\n const h1 = this._halfedges[e1]!;\n const h2 = this._halfedges[e2]!;\n\n const t0 = this._addTriangle(p0, p1, pn, h0, -1, -1, e0);\n const t1 = this._addTriangle(p1, p2, pn, h1, -1, t0 + 1);\n const t2 = this._addTriangle(p2, p0, pn, h2, t0 + 2, t1 + 1);\n\n this._legalize(t0);\n this._legalize(t1);\n this._legalize(t2);\n }\n }\n\n // add coordinates for a new vertex\n private _addPoint(u: number, v: number): number {\n const i = this.uvs.length >> 1;\n this.uvs.push(u, v);\n\n // compute and store exact output position via reprojection\n const pixelX = u * (this.width - 1);\n const pixelY = v * (this.height - 1);\n const inputPosition = this.reprojectors.pixelToInputCRS(pixelX, pixelY);\n const exactOutputPosition = this.reprojectors.forwardReproject(\n inputPosition[0],\n inputPosition[1],\n );\n this.exactOutputPositions.push(\n exactOutputPosition[0]!,\n exactOutputPosition[1]!,\n );\n\n return i;\n }\n\n // add or update a triangle in the mesh\n _addTriangle(\n a: number,\n b: number,\n c: number,\n ab: number,\n bc: number,\n ca: number,\n e: number = this.triangles.length,\n ) {\n const t = e / 3; // new triangle index\n\n // add triangle vertices\n this.triangles[e + 0] = a;\n this.triangles[e + 1] = b;\n this.triangles[e + 2] = c;\n\n // add triangle halfedges\n this._halfedges[e + 0] = ab;\n this._halfedges[e + 1] = bc;\n this._halfedges[e + 2] = ca;\n\n // link neighboring halfedges\n if (ab >= 0) {\n this._halfedges[ab] = e + 0;\n }\n if (bc >= 0) {\n this._halfedges[bc] = e + 1;\n }\n if (ca >= 0) {\n this._halfedges[ca] = e + 2;\n }\n\n // init triangle metadata\n this._candidatesUV[2 * t + 0] = 0;\n this._candidatesUV[2 * t + 1] = 0;\n this._queueIndices[t] = -1;\n\n // add triangle to pending queue for later rasterization\n this._pending[this._pendingLen++] = t;\n\n // return first halfedge index\n return e;\n }\n\n private _legalize(a: number): void {\n // if the pair of triangles doesn't satisfy the Delaunay condition\n // (p1 is inside the circumcircle of [p0, pl, pr]), flip them,\n // then do the same check/flip recursively for the new pair of triangles\n //\n // pl pl\n // /||\\ / \\\n // al/ || \\bl al/ \\a\n // / || \\ / \\\n // / a||b \\ flip /___ar___\\\n // p0\\ || /p1 => p0\\---bl---/p1\n // \\ || / \\ /\n // ar\\ || /br b\\ /br\n // \\||/ \\ /\n // pr pr\n\n const b = this._halfedges[a]!;\n\n if (b < 0) {\n return;\n }\n\n const a0 = a - (a % 3);\n const b0 = b - (b % 3);\n const al = a0 + ((a + 1) % 3);\n const ar = a0 + ((a + 2) % 3);\n const bl = b0 + ((b + 2) % 3);\n const br = b0 + ((b + 1) % 3);\n const p0 = this.triangles[ar]!;\n const pr = this.triangles[a]!;\n const pl = this.triangles[al]!;\n const p1 = this.triangles[bl]!;\n const uvs = this.uvs;\n\n if (\n !inCircle(\n uvs[2 * p0]!,\n uvs[2 * p0 + 1]!,\n uvs[2 * pr]!,\n uvs[2 * pr + 1]!,\n uvs[2 * pl]!,\n uvs[2 * pl + 1]!,\n uvs[2 * p1]!,\n uvs[2 * p1 + 1]!,\n )\n ) {\n return;\n }\n\n const hal = this._halfedges[al]!;\n const har = this._halfedges[ar]!;\n const hbl = this._halfedges[bl]!;\n const hbr = this._halfedges[br]!;\n\n this._queueRemove(a0 / 3);\n this._queueRemove(b0 / 3);\n\n const t0 = this._addTriangle(p0, p1, pl, -1, hbl, hal, a0);\n const t1 = this._addTriangle(p1, p0, pr, t0, har, hbr, b0);\n\n this._legalize(t0 + 1);\n this._legalize(t1 + 2);\n }\n\n // handle a case where new vertex is on the edge of a triangle\n private _handleCollinear(pn: number, a: number): void {\n const a0 = a - (a % 3);\n const al = a0 + ((a + 1) % 3);\n const ar = a0 + ((a + 2) % 3);\n const p0 = this.triangles[ar]!;\n const pr = this.triangles[a]!;\n const pl = this.triangles[al]!;\n const hal = this._halfedges[al]!;\n const har = this._halfedges[ar]!;\n\n const b = this._halfedges[a]!;\n\n if (b < 0) {\n const t0 = this._addTriangle(pn, p0, pr, -1, har, -1, a0);\n const t1 = this._addTriangle(p0, pn, pl, t0, -1, hal);\n this._legalize(t0 + 1);\n this._legalize(t1 + 2);\n return;\n }\n\n const b0 = b - (b % 3);\n const bl = b0 + ((b + 2) % 3);\n const br = b0 + ((b + 1) % 3);\n const p1 = this.triangles[bl]!;\n const hbl = this._halfedges[bl]!;\n const hbr = this._halfedges[br]!;\n\n this._queueRemove(b0 / 3);\n\n const t0 = this._addTriangle(p0, pr, pn, har, -1, -1, a0);\n const t1 = this._addTriangle(pr, p1, pn, hbr, -1, t0 + 1, b0);\n const t2 = this._addTriangle(p1, pl, pn, hbl, -1, t1 + 1);\n const t3 = this._addTriangle(pl, p0, pn, hal, t0 + 2, t2 + 1);\n\n this._legalize(t0);\n this._legalize(t1);\n this._legalize(t2);\n this._legalize(t3);\n }\n\n // priority queue methods\n\n private _queuePush(t: number, error: number): void {\n const i = this._queue.length;\n this._queueIndices[t] = i;\n this._queue.push(t);\n this._errors.push(error);\n this._queueUp(i);\n }\n\n private _queuePop(): number {\n const n = this._queue.length - 1;\n this._queueSwap(0, n);\n this._queueDown(0, n);\n return this._queuePopBack()!;\n }\n\n private _queuePopBack(): number {\n const t = this._queue.pop()!;\n this._errors.pop();\n this._queueIndices[t] = -1;\n return t;\n }\n\n private _queueRemove(t: number): void {\n const i = this._queueIndices[t]!;\n if (i < 0) {\n const it = this._pending.indexOf(t);\n if (it !== -1) {\n this._pending[it] = this._pending[--this._pendingLen]!;\n } else {\n throw new Error(\"Broken triangulation (something went wrong).\");\n }\n return;\n }\n const n = this._queue.length - 1;\n if (n !== i) {\n this._queueSwap(i, n);\n if (!this._queueDown(i, n)) {\n this._queueUp(i);\n }\n }\n this._queuePopBack();\n }\n\n private _queueLess(i: number, j: number): boolean {\n return this._errors[i]! > this._errors[j]!;\n }\n\n private _queueSwap(i: number, j: number): void {\n const pi = this._queue[i]!;\n const pj = this._queue[j]!;\n this._queue[i] = pj;\n this._queue[j] = pi;\n this._queueIndices[pi] = j;\n this._queueIndices[pj] = i;\n const e = this._errors[i]!;\n this._errors[i] = this._errors[j]!;\n this._errors[j] = e;\n }\n\n private _queueUp(j0: number): void {\n let j = j0;\n while (true) {\n const i = (j - 1) >> 1;\n if (i === j || !this._queueLess(j, i)) {\n break;\n }\n this._queueSwap(i, j);\n j = i;\n }\n }\n\n private _queueDown(i0: number, n: number): boolean {\n let i = i0;\n while (true) {\n const j1 = 2 * i + 1;\n if (j1 >= n || j1 < 0) {\n break;\n }\n const j2 = j1 + 1;\n let j = j1;\n if (j2 < n && this._queueLess(j2, j1)) {\n j = j2;\n }\n if (!this._queueLess(j, i)) {\n break;\n }\n this._queueSwap(i, j);\n i = j;\n }\n return i > i0;\n }\n}\n\nfunction orient(\n ax: number,\n ay: number,\n bx: number,\n by: number,\n cx: number,\n cy: number,\n): number {\n return (bx - cx) * (ay - cy) - (by - cy) * (ax - cx);\n}\n\nfunction inCircle(\n ax: number,\n ay: number,\n bx: number,\n by: number,\n cx: number,\n cy: number,\n px: number,\n py: number,\n): boolean {\n const dx = ax - px;\n const dy = ay - py;\n const ex = bx - px;\n const ey = by - py;\n const fx = cx - px;\n const fy = cy - py;\n\n const ap = dx * dx + dy * dy;\n const bp = ex * ex + ey * ey;\n const cp = fx * fx + fy * fy;\n\n return (\n dx * (ey * cp - bp * fy) -\n dy * (ex * cp - bp * fx) +\n ap * (ex * fy - ey * fx) <\n 0\n );\n}\n\n/**\n * Interpolate the value at a given barycentric coordinate within a triangle.\n *\n * I've seen the name \"mix\" used before in graphics programming to refer to\n * barycentric linear interpolation.\n *\n * Note: the caller must call this method twice: once for u and once again for\n * v. We do this because we want to avoid allocating an array for the return\n * value.\n */\nfunction barycentricMix(\n a: number,\n b: number,\n c: number,\n // Barycentric coordinates\n t0: number,\n t1: number,\n t2: number,\n): number {\n return t0 * a + t1 * b + t2 * c;\n}\n","export type GeoTransform = [number, number, number, number, number, number];\n\n/**\n * Find the inverse of this GeoTransform.\n *\n * Ported from rasterio/affine:\n * https://github.com/rasterio/affine/blob/a7a916fc7012f8afeb6489246ada61a76ccb8bc7/src/affine.py#L671-L692\n * under the BSD-3-Clause License.\n *\n * @param {GeoTransform} gt Geotransform.\n *\n * @return {GeoTransform} Inverse of the geotransform.\n */\nexport function invertGeoTransform(gt: GeoTransform): GeoTransform {\n if (isDegenerate(gt)) {\n throw new Error(\"Cannot invert degenerate transform\");\n }\n\n const idet = 1.0 / determinant(gt);\n const [sa, sb, sc, sd, se, sf] = gt;\n const ra = se * idet;\n const rb = -sb * idet;\n const rd = -sd * idet;\n const re = sa * idet;\n // prettier-ignore\n return [\n ra, rb, -sc * ra - sf * rb,\n rd, re, -sc * rd - sf * re,\n ];\n}\n\nfunction isDegenerate(gt: GeoTransform): boolean {\n return determinant(gt) === 0;\n}\n\nfunction determinant(gt: GeoTransform): number {\n return a(gt) * e(gt) - b(gt) * d(gt);\n}\n\nfunction a(gt: GeoTransform): number {\n return gt[0];\n}\n\nfunction b(gt: GeoTransform): number {\n return gt[1];\n}\n\n// function c(gt: GeoTransform): number {\n// return gt[2];\n// }\n\nfunction d(gt: GeoTransform): number {\n return gt[3];\n}\n\nfunction e(gt: GeoTransform): number {\n return gt[4];\n}\n\n// function f(gt: GeoTransform): number {\n// return gt[5];\n// }\n\n/**\n * Apply a GeoTransform to a coordinate.\n */\nexport function applyAffine(\n x: number,\n y: number,\n gt: [number, number, number, number, number, number],\n): [number, number] {\n const [a, b, c, d, e, f] = gt;\n return [a * x + b * y + c, d * x + e * y + f];\n}\n","/* eslint-env browser */\n\nimport type { GeoTIFF, GeoTIFFImage } from \"geotiff\";\nimport { ReprojectionFns } from \"./delatin\";\nimport { applyAffine, invertGeoTransform } from \"./affine\";\nimport proj4 from \"proj4\";\nimport type { PROJJSONDefinition } from \"proj4/dist/lib/core\";\nimport type Projection from \"proj4/dist/lib/Proj\";\n\nconst OGC_84: PROJJSONDefinition = {\n $schema: \"https://proj.org/schemas/v0.7/projjson.schema.json\",\n type: \"GeographicCRS\",\n name: \"WGS 84 (CRS84)\",\n datum_ensemble: {\n name: \"World Geodetic System 1984 ensemble\",\n members: [\n {\n name: \"World Geodetic System 1984 (Transit)\",\n id: { authority: \"EPSG\", code: 1166 },\n },\n {\n name: \"World Geodetic System 1984 (G730)\",\n id: { authority: \"EPSG\", code: 1152 },\n },\n {\n name: \"World Geodetic System 1984 (G873)\",\n id: { authority: \"EPSG\", code: 1153 },\n },\n {\n name: \"World Geodetic System 1984 (G1150)\",\n id: { authority: \"EPSG\", code: 1154 },\n },\n {\n name: \"World Geodetic System 1984 (G1674)\",\n id: { authority: \"EPSG\", code: 1155 },\n },\n {\n name: \"World Geodetic System 1984 (G1762)\",\n id: { authority: \"EPSG\", code: 1156 },\n },\n {\n name: \"World Geodetic System 1984 (G2139)\",\n id: { authority: \"EPSG\", code: 1309 },\n },\n ],\n ellipsoid: {\n name: \"WGS 84\",\n semi_major_axis: 6378137,\n inverse_flattening: 298.257223563,\n },\n accuracy: \"2.0\",\n id: { authority: \"EPSG\", code: 6326 },\n },\n coordinate_system: {\n subtype: \"ellipsoidal\",\n axis: [\n {\n name: \"Geodetic longitude\",\n abbreviation: \"Lon\",\n direction: \"east\",\n unit: \"degree\",\n },\n {\n name: \"Geodetic latitude\",\n abbreviation: \"Lat\",\n direction: \"north\",\n unit: \"degree\",\n },\n ],\n },\n scope: \"Not known.\",\n area: \"World.\",\n bbox: {\n south_latitude: -90,\n west_longitude: -180,\n north_latitude: 90,\n east_longitude: 180,\n },\n // @ts-expect-error - proj4 types are incomplete\n id: { authority: \"OGC\", code: \"CRS84\" },\n};\n\n// Derived from existing work here:\n// https://github.com/developmentseed/lonboard/blob/35a1f3d691604ad9e083bf10a4bfde4158171486/src/cog-tileset/claude-tileset-2d-improved.ts#L141\n//\n// TODO: return a RasterReprojector instance, given the IFD and tile of interest?\nexport async function extractGeotiffReprojectors(\n tiff: GeoTIFF,\n outputCrs: string | PROJJSONDefinition | Projection = OGC_84,\n): Promise<ReprojectionFns> {\n const image = await tiff.getImage();\n\n const geoKeys = image.getGeoKeys();\n const projectionCode: number | null =\n geoKeys.ProjectedCSTypeGeoKey || geoKeys.GeographicTypeGeoKey || null;\n\n // Extract geotransform from full-resolution image\n // Only the top-level IFD has geo keys, so we'll derive overviews from this\n const baseGeotransform = extractGeotransform(image);\n\n const sourceProjection = await getProjjson(projectionCode);\n if (sourceProjection === null) {\n throw new Error(\n \"Could not determine source projection from GeoTIFF geo keys\",\n );\n }\n const converter = proj4(sourceProjection, outputCrs);\n const { pixelToInputCRS, inputCRSToPixel } =\n fromGeoTransform(baseGeotransform);\n\n return {\n pixelToInputCRS,\n inputCRSToPixel,\n forwardReproject: (x: number, y: number) =>\n converter.forward([x, y], false),\n inverseReproject: (x: number, y: number) =>\n converter.inverse([x, y], false),\n };\n}\n\nexport function fromGeoTransform(\n geotransform: [number, number, number, number, number, number],\n): {\n pixelToInputCRS: (x: number, y: number) => [number, number];\n inputCRSToPixel: (x: number, y: number) => [number, number];\n} {\n const inverseGeotransform = invertGeoTransform(geotransform);\n return {\n pixelToInputCRS: (x: number, y: number) => applyAffine(x, y, geotransform),\n inputCRSToPixel: (x: number, y: number) =>\n applyAffine(x, y, inverseGeotransform),\n };\n}\n\n/** Query epsg.io for the PROJJSON corresponding to the given EPSG code. */\nasync function getProjjson(projectionCode: number | null) {\n if (projectionCode === null) {\n return null;\n }\n\n const url = `https://epsg.io/${projectionCode}.json`;\n const response = await fetch(url);\n if (!response.ok) {\n throw new Error(`Failed to fetch projection data from ${url}`);\n }\n const data = await response.json();\n return data;\n}\n\n/**\n * Extract affine geotransform from a GeoTIFF image.\n *\n * Returns a 6-element array in Python `affine` package ordering:\n * [a, b, c, d, e, f] where:\n * - x_geo = a * col + b * row + c\n * - y_geo = d * col + e * row + f\n *\n * This is NOT GDAL ordering, which is [c, a, b, f, d, e].\n */\nfunction extractGeotransform(\n image: GeoTIFFImage,\n): [number, number, number, number, number, number] {\n const origin = image.getOrigin();\n const resolution = image.getResolution();\n\n // origin: [x, y, z]\n // resolution: [x_res, y_res, z_res]\n\n // Check for rotation/skew in the file directory\n const fileDirectory = image.getFileDirectory();\n const modelTransformation = fileDirectory.ModelTransformation;\n\n let b = 0; // row rotation\n let d = 0; // column rotation\n\n if (modelTransformation && modelTransformation.length >= 16) {\n // ModelTransformation is a 4x4 matrix in row-major order\n // [0 1 2 3 ] [a b 0 c]\n // [4 5 6 7 ] = [d e 0 f]\n // [8 9 10 11] [0 0 1 0]\n // [12 13 14 15] [0 0 0 1]\n b = modelTransformation[1];\n d = modelTransformation[4];\n }\n\n // Return in affine package ordering: [a, b, c, d, e, f]\n return [\n resolution[0]!, // a: pixel width\n b, // b: row rotation\n origin[0]!, // c: x origin\n d, // d: column rotation\n resolution[1]!, // e: pixel height (often negative)\n origin[1]!, // f: y origin\n ];\n}\n"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { GeoTIFF } from 'geotiff';
|
|
2
|
+
import { PROJJSONDefinition } from 'proj4/dist/lib/core';
|
|
3
|
+
import Projection from 'proj4/dist/lib/Proj';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Define [**uv coordinates**](https://en.wikipedia.org/wiki/UV_mapping) as a float-valued image-local coordinate space where the top left is `(0, 0)` and the bottom right is `(1, 1)`.
|
|
7
|
+
*
|
|
8
|
+
* Define [**Barycentric coordinates**](https://en.wikipedia.org/wiki/Barycentric_coordinate_system) as float-valued triangle-local coordinates, represented as a 3-tuple of floats, where the tuple must add up to 1. The coordinate represents "how close to each vertex" a point in the interior of a triangle is. I.e. `(0, 0, 1)`, `(0, 1, 0)`, and `(1, 0, 0)` are all valid barycentric coordinates that define one of the three vertices. `(1/3, 1/3, 1/3)` represents the centroid of a triangle. `(1/2, 1/2, 0)` represents a point that is halfway between vertices `a` and `b` and has "none" of vertex `c`.
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
* ## Changes
|
|
12
|
+
*
|
|
13
|
+
* - Delatin coordinates are in terms of pixel space whereas here we use uv space.
|
|
14
|
+
*
|
|
15
|
+
* Originally copied from https://github.com/mapbox/delatin under the ISC
|
|
16
|
+
* license, then subject to further modifications.
|
|
17
|
+
*/
|
|
18
|
+
interface ReprojectionFns {
|
|
19
|
+
/**
|
|
20
|
+
* Convert from UV coordinates to input CRS coordinates.
|
|
21
|
+
*
|
|
22
|
+
* This is the affine geotransform from the input image.
|
|
23
|
+
*/
|
|
24
|
+
pixelToInputCRS(x: number, y: number): [number, number];
|
|
25
|
+
/**
|
|
26
|
+
* Convert from input CRS coordinates back to UV coordinates.
|
|
27
|
+
*
|
|
28
|
+
* Inverse of the affine geotransform from the input image.
|
|
29
|
+
*/
|
|
30
|
+
inputCRSToPixel(x: number, y: number): [number, number];
|
|
31
|
+
/**
|
|
32
|
+
* Apply the forward projection from input CRS to output CRS.
|
|
33
|
+
*/
|
|
34
|
+
forwardReproject(x: number, y: number): [number, number];
|
|
35
|
+
/**
|
|
36
|
+
* Apply the inverse projection from output CRS back to input CRS.
|
|
37
|
+
*/
|
|
38
|
+
inverseReproject(x: number, y: number): [number, number];
|
|
39
|
+
}
|
|
40
|
+
declare class RasterReprojector {
|
|
41
|
+
reprojectors: ReprojectionFns;
|
|
42
|
+
width: number;
|
|
43
|
+
height: number;
|
|
44
|
+
/**
|
|
45
|
+
* UV vertex coordinates (x, y), i.e.
|
|
46
|
+
* [x0, y0, x1, y1, ...]
|
|
47
|
+
*
|
|
48
|
+
* These coordinates are floats that range from [0, 1] in both X and Y.
|
|
49
|
+
*/
|
|
50
|
+
uvs: number[];
|
|
51
|
+
/**
|
|
52
|
+
* XY Positions in output CRS, computed via exact forward reprojection.
|
|
53
|
+
*/
|
|
54
|
+
exactOutputPositions: number[];
|
|
55
|
+
/**
|
|
56
|
+
* triangle vertex indices
|
|
57
|
+
*/
|
|
58
|
+
triangles: number[];
|
|
59
|
+
private _halfedges;
|
|
60
|
+
/**
|
|
61
|
+
* The UV texture coordinates of candidates found from
|
|
62
|
+
* `findReprojectionCandidate`.
|
|
63
|
+
*
|
|
64
|
+
* Maybe in the future we'll want to store the barycentric coordinates instead
|
|
65
|
+
* of just the uv coordinates?
|
|
66
|
+
*/
|
|
67
|
+
private _candidatesUV;
|
|
68
|
+
private _queueIndices;
|
|
69
|
+
private _queue;
|
|
70
|
+
private _errors;
|
|
71
|
+
private _pending;
|
|
72
|
+
private _pendingLen;
|
|
73
|
+
constructor(reprojectors: ReprojectionFns, width: number, height?: number);
|
|
74
|
+
run(maxError?: number): void;
|
|
75
|
+
refine(): void;
|
|
76
|
+
getMaxError(): number;
|
|
77
|
+
private _flush;
|
|
78
|
+
/**
|
|
79
|
+
* Conversion of upstream's `_findCandidate` for reprojection error handling.
|
|
80
|
+
*
|
|
81
|
+
* @param {number} t The index (into `this.triangles`) of the pending triangle to process.
|
|
82
|
+
*
|
|
83
|
+
* @return {void} Doesn't return; instead modifies internal state.
|
|
84
|
+
*/
|
|
85
|
+
private _findReprojectionCandidate;
|
|
86
|
+
private _step;
|
|
87
|
+
private _addPoint;
|
|
88
|
+
_addTriangle(a: number, b: number, c: number, ab: number, bc: number, ca: number, e?: number): number;
|
|
89
|
+
private _legalize;
|
|
90
|
+
private _handleCollinear;
|
|
91
|
+
private _queuePush;
|
|
92
|
+
private _queuePop;
|
|
93
|
+
private _queuePopBack;
|
|
94
|
+
private _queueRemove;
|
|
95
|
+
private _queueLess;
|
|
96
|
+
private _queueSwap;
|
|
97
|
+
private _queueUp;
|
|
98
|
+
private _queueDown;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
type GeoTransform = [number, number, number, number, number, number];
|
|
102
|
+
/**
|
|
103
|
+
* Find the inverse of this GeoTransform.
|
|
104
|
+
*
|
|
105
|
+
* Ported from rasterio/affine:
|
|
106
|
+
* https://github.com/rasterio/affine/blob/a7a916fc7012f8afeb6489246ada61a76ccb8bc7/src/affine.py#L671-L692
|
|
107
|
+
* under the BSD-3-Clause License.
|
|
108
|
+
*
|
|
109
|
+
* @param {GeoTransform} gt Geotransform.
|
|
110
|
+
*
|
|
111
|
+
* @return {GeoTransform} Inverse of the geotransform.
|
|
112
|
+
*/
|
|
113
|
+
declare function invertGeoTransform(gt: GeoTransform): GeoTransform;
|
|
114
|
+
/**
|
|
115
|
+
* Apply a GeoTransform to a coordinate.
|
|
116
|
+
*/
|
|
117
|
+
declare function applyAffine(x: number, y: number, gt: [number, number, number, number, number, number]): [number, number];
|
|
118
|
+
|
|
119
|
+
type affine_GeoTransform = GeoTransform;
|
|
120
|
+
declare const affine_applyAffine: typeof applyAffine;
|
|
121
|
+
declare const affine_invertGeoTransform: typeof invertGeoTransform;
|
|
122
|
+
declare namespace affine {
|
|
123
|
+
export { type affine_GeoTransform as GeoTransform, affine_applyAffine as applyAffine, affine_invertGeoTransform as invertGeoTransform };
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
declare function extractGeotiffReprojectors(tiff: GeoTIFF, outputCrs?: string | PROJJSONDefinition | Projection): Promise<ReprojectionFns>;
|
|
127
|
+
declare function fromGeoTransform(geotransform: [number, number, number, number, number, number]): {
|
|
128
|
+
pixelToInputCRS: (x: number, y: number) => [number, number];
|
|
129
|
+
inputCRSToPixel: (x: number, y: number) => [number, number];
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
type index_RasterReprojector = RasterReprojector;
|
|
133
|
+
declare const index_RasterReprojector: typeof RasterReprojector;
|
|
134
|
+
type index_ReprojectionFns = ReprojectionFns;
|
|
135
|
+
declare const index_affine: typeof affine;
|
|
136
|
+
declare const index_extractGeotiffReprojectors: typeof extractGeotiffReprojectors;
|
|
137
|
+
declare const index_fromGeoTransform: typeof fromGeoTransform;
|
|
138
|
+
declare namespace index {
|
|
139
|
+
export { index_RasterReprojector as RasterReprojector, type index_ReprojectionFns as ReprojectionFns, index_affine as affine, index_extractGeotiffReprojectors as extractGeotiffReprojectors, index_fromGeoTransform as fromGeoTransform };
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export { index as reprojection };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { GeoTIFF } from 'geotiff';
|
|
2
|
+
import { PROJJSONDefinition } from 'proj4/dist/lib/core';
|
|
3
|
+
import Projection from 'proj4/dist/lib/Proj';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Define [**uv coordinates**](https://en.wikipedia.org/wiki/UV_mapping) as a float-valued image-local coordinate space where the top left is `(0, 0)` and the bottom right is `(1, 1)`.
|
|
7
|
+
*
|
|
8
|
+
* Define [**Barycentric coordinates**](https://en.wikipedia.org/wiki/Barycentric_coordinate_system) as float-valued triangle-local coordinates, represented as a 3-tuple of floats, where the tuple must add up to 1. The coordinate represents "how close to each vertex" a point in the interior of a triangle is. I.e. `(0, 0, 1)`, `(0, 1, 0)`, and `(1, 0, 0)` are all valid barycentric coordinates that define one of the three vertices. `(1/3, 1/3, 1/3)` represents the centroid of a triangle. `(1/2, 1/2, 0)` represents a point that is halfway between vertices `a` and `b` and has "none" of vertex `c`.
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
* ## Changes
|
|
12
|
+
*
|
|
13
|
+
* - Delatin coordinates are in terms of pixel space whereas here we use uv space.
|
|
14
|
+
*
|
|
15
|
+
* Originally copied from https://github.com/mapbox/delatin under the ISC
|
|
16
|
+
* license, then subject to further modifications.
|
|
17
|
+
*/
|
|
18
|
+
interface ReprojectionFns {
|
|
19
|
+
/**
|
|
20
|
+
* Convert from UV coordinates to input CRS coordinates.
|
|
21
|
+
*
|
|
22
|
+
* This is the affine geotransform from the input image.
|
|
23
|
+
*/
|
|
24
|
+
pixelToInputCRS(x: number, y: number): [number, number];
|
|
25
|
+
/**
|
|
26
|
+
* Convert from input CRS coordinates back to UV coordinates.
|
|
27
|
+
*
|
|
28
|
+
* Inverse of the affine geotransform from the input image.
|
|
29
|
+
*/
|
|
30
|
+
inputCRSToPixel(x: number, y: number): [number, number];
|
|
31
|
+
/**
|
|
32
|
+
* Apply the forward projection from input CRS to output CRS.
|
|
33
|
+
*/
|
|
34
|
+
forwardReproject(x: number, y: number): [number, number];
|
|
35
|
+
/**
|
|
36
|
+
* Apply the inverse projection from output CRS back to input CRS.
|
|
37
|
+
*/
|
|
38
|
+
inverseReproject(x: number, y: number): [number, number];
|
|
39
|
+
}
|
|
40
|
+
declare class RasterReprojector {
|
|
41
|
+
reprojectors: ReprojectionFns;
|
|
42
|
+
width: number;
|
|
43
|
+
height: number;
|
|
44
|
+
/**
|
|
45
|
+
* UV vertex coordinates (x, y), i.e.
|
|
46
|
+
* [x0, y0, x1, y1, ...]
|
|
47
|
+
*
|
|
48
|
+
* These coordinates are floats that range from [0, 1] in both X and Y.
|
|
49
|
+
*/
|
|
50
|
+
uvs: number[];
|
|
51
|
+
/**
|
|
52
|
+
* XY Positions in output CRS, computed via exact forward reprojection.
|
|
53
|
+
*/
|
|
54
|
+
exactOutputPositions: number[];
|
|
55
|
+
/**
|
|
56
|
+
* triangle vertex indices
|
|
57
|
+
*/
|
|
58
|
+
triangles: number[];
|
|
59
|
+
private _halfedges;
|
|
60
|
+
/**
|
|
61
|
+
* The UV texture coordinates of candidates found from
|
|
62
|
+
* `findReprojectionCandidate`.
|
|
63
|
+
*
|
|
64
|
+
* Maybe in the future we'll want to store the barycentric coordinates instead
|
|
65
|
+
* of just the uv coordinates?
|
|
66
|
+
*/
|
|
67
|
+
private _candidatesUV;
|
|
68
|
+
private _queueIndices;
|
|
69
|
+
private _queue;
|
|
70
|
+
private _errors;
|
|
71
|
+
private _pending;
|
|
72
|
+
private _pendingLen;
|
|
73
|
+
constructor(reprojectors: ReprojectionFns, width: number, height?: number);
|
|
74
|
+
run(maxError?: number): void;
|
|
75
|
+
refine(): void;
|
|
76
|
+
getMaxError(): number;
|
|
77
|
+
private _flush;
|
|
78
|
+
/**
|
|
79
|
+
* Conversion of upstream's `_findCandidate` for reprojection error handling.
|
|
80
|
+
*
|
|
81
|
+
* @param {number} t The index (into `this.triangles`) of the pending triangle to process.
|
|
82
|
+
*
|
|
83
|
+
* @return {void} Doesn't return; instead modifies internal state.
|
|
84
|
+
*/
|
|
85
|
+
private _findReprojectionCandidate;
|
|
86
|
+
private _step;
|
|
87
|
+
private _addPoint;
|
|
88
|
+
_addTriangle(a: number, b: number, c: number, ab: number, bc: number, ca: number, e?: number): number;
|
|
89
|
+
private _legalize;
|
|
90
|
+
private _handleCollinear;
|
|
91
|
+
private _queuePush;
|
|
92
|
+
private _queuePop;
|
|
93
|
+
private _queuePopBack;
|
|
94
|
+
private _queueRemove;
|
|
95
|
+
private _queueLess;
|
|
96
|
+
private _queueSwap;
|
|
97
|
+
private _queueUp;
|
|
98
|
+
private _queueDown;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
type GeoTransform = [number, number, number, number, number, number];
|
|
102
|
+
/**
|
|
103
|
+
* Find the inverse of this GeoTransform.
|
|
104
|
+
*
|
|
105
|
+
* Ported from rasterio/affine:
|
|
106
|
+
* https://github.com/rasterio/affine/blob/a7a916fc7012f8afeb6489246ada61a76ccb8bc7/src/affine.py#L671-L692
|
|
107
|
+
* under the BSD-3-Clause License.
|
|
108
|
+
*
|
|
109
|
+
* @param {GeoTransform} gt Geotransform.
|
|
110
|
+
*
|
|
111
|
+
* @return {GeoTransform} Inverse of the geotransform.
|
|
112
|
+
*/
|
|
113
|
+
declare function invertGeoTransform(gt: GeoTransform): GeoTransform;
|
|
114
|
+
/**
|
|
115
|
+
* Apply a GeoTransform to a coordinate.
|
|
116
|
+
*/
|
|
117
|
+
declare function applyAffine(x: number, y: number, gt: [number, number, number, number, number, number]): [number, number];
|
|
118
|
+
|
|
119
|
+
type affine_GeoTransform = GeoTransform;
|
|
120
|
+
declare const affine_applyAffine: typeof applyAffine;
|
|
121
|
+
declare const affine_invertGeoTransform: typeof invertGeoTransform;
|
|
122
|
+
declare namespace affine {
|
|
123
|
+
export { type affine_GeoTransform as GeoTransform, affine_applyAffine as applyAffine, affine_invertGeoTransform as invertGeoTransform };
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
declare function extractGeotiffReprojectors(tiff: GeoTIFF, outputCrs?: string | PROJJSONDefinition | Projection): Promise<ReprojectionFns>;
|
|
127
|
+
declare function fromGeoTransform(geotransform: [number, number, number, number, number, number]): {
|
|
128
|
+
pixelToInputCRS: (x: number, y: number) => [number, number];
|
|
129
|
+
inputCRSToPixel: (x: number, y: number) => [number, number];
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
type index_RasterReprojector = RasterReprojector;
|
|
133
|
+
declare const index_RasterReprojector: typeof RasterReprojector;
|
|
134
|
+
type index_ReprojectionFns = ReprojectionFns;
|
|
135
|
+
declare const index_affine: typeof affine;
|
|
136
|
+
declare const index_extractGeotiffReprojectors: typeof extractGeotiffReprojectors;
|
|
137
|
+
declare const index_fromGeoTransform: typeof fromGeoTransform;
|
|
138
|
+
declare namespace index {
|
|
139
|
+
export { index_RasterReprojector as RasterReprojector, type index_ReprojectionFns as ReprojectionFns, index_affine as affine, index_extractGeotiffReprojectors as extractGeotiffReprojectors, index_fromGeoTransform as fromGeoTransform };
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export { index as reprojection };
|