geotiffimage.d.ts 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. export default GeoTIFFImage;
  2. export type ReadRasterOptions = {
  3. /**
  4. * window] the subset to read data from in pixels.
  5. */
  6. window?: number[] | undefined;
  7. /**
  8. * image] the subset to read data from in
  9. * geographical coordinates.
  10. */
  11. bbox?: number[] | undefined;
  12. /**
  13. * samples] the selection of samples to read from. Default is all samples.
  14. */
  15. samples?: number[] | undefined;
  16. /**
  17. * whether the data shall be read
  18. * in one single array or separate
  19. * arrays.
  20. */
  21. interleave?: boolean | undefined;
  22. /**
  23. * The optional decoder pool to use.
  24. */
  25. pool?: any;
  26. /**
  27. * The desired width of the output. When the width is not the
  28. * same as the images, resampling will be performed.
  29. */
  30. width?: number | undefined;
  31. /**
  32. * The desired height of the output. When the width is not the
  33. * same as the images, resampling will be performed.
  34. */
  35. height?: number | undefined;
  36. /**
  37. * The desired resampling method.
  38. */
  39. resampleMethod?: string | undefined;
  40. /**
  41. * An AbortSignal that may be signalled if the request is
  42. * to be aborted
  43. */
  44. signal?: AbortSignal | undefined;
  45. /**
  46. * The value to use for parts of the image
  47. * outside of the images extent. When multiple
  48. * samples are requested, an array of fill values
  49. * can be passed.
  50. */
  51. fillValue?: number | number[] | undefined;
  52. };
  53. export type TypedArray = import("./geotiff.js").TypedArray;
  54. export type ReadRasterResult = import("./geotiff.js").ReadRasterResult;
  55. /**
  56. * GeoTIFF sub-file image.
  57. */
  58. declare class GeoTIFFImage {
  59. /**
  60. * @constructor
  61. * @param {Object} fileDirectory The parsed file directory
  62. * @param {Object} geoKeys The parsed geo-keys
  63. * @param {DataView} dataView The DataView for the underlying file.
  64. * @param {Boolean} littleEndian Whether the file is encoded in little or big endian
  65. * @param {Boolean} cache Whether or not decoded tiles shall be cached
  66. * @param {import('./source/basesource').BaseSource} source The datasource to read from
  67. */
  68. constructor(fileDirectory: any, geoKeys: any, dataView: DataView, littleEndian: boolean, cache: boolean, source: import('./source/basesource').BaseSource);
  69. fileDirectory: any;
  70. geoKeys: any;
  71. dataView: DataView;
  72. littleEndian: boolean;
  73. tiles: {} | null;
  74. isTiled: boolean;
  75. planarConfiguration: any;
  76. source: import("./source/basesource").BaseSource;
  77. /**
  78. * Returns the associated parsed file directory.
  79. * @returns {Object} the parsed file directory
  80. */
  81. getFileDirectory(): any;
  82. /**
  83. * Returns the associated parsed geo keys.
  84. * @returns {Object} the parsed geo keys
  85. */
  86. getGeoKeys(): any;
  87. /**
  88. * Returns the width of the image.
  89. * @returns {Number} the width of the image
  90. */
  91. getWidth(): number;
  92. /**
  93. * Returns the height of the image.
  94. * @returns {Number} the height of the image
  95. */
  96. getHeight(): number;
  97. /**
  98. * Returns the number of samples per pixel.
  99. * @returns {Number} the number of samples per pixel
  100. */
  101. getSamplesPerPixel(): number;
  102. /**
  103. * Returns the width of each tile.
  104. * @returns {Number} the width of each tile
  105. */
  106. getTileWidth(): number;
  107. /**
  108. * Returns the height of each tile.
  109. * @returns {Number} the height of each tile
  110. */
  111. getTileHeight(): number;
  112. getBlockWidth(): number;
  113. getBlockHeight(y: any): number;
  114. /**
  115. * Calculates the number of bytes for each pixel across all samples. Only full
  116. * bytes are supported, an exception is thrown when this is not the case.
  117. * @returns {Number} the bytes per pixel
  118. */
  119. getBytesPerPixel(): number;
  120. getSampleByteSize(i: any): number;
  121. getReaderForSample(sampleIndex: any): (byteOffset: number, littleEndian?: boolean | undefined) => number;
  122. getSampleFormat(sampleIndex?: number): any;
  123. getBitsPerSample(sampleIndex?: number): any;
  124. getArrayForSample(sampleIndex: any, size: any): Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;
  125. /**
  126. * Returns the decoded strip or tile.
  127. * @param {Number} x the strip or tile x-offset
  128. * @param {Number} y the tile y-offset (0 for stripped images)
  129. * @param {Number} sample the sample to get for separated samples
  130. * @param {import("./geotiff").Pool|import("./geotiff").BaseDecoder} poolOrDecoder the decoder or decoder pool
  131. * @param {AbortSignal} [signal] An AbortSignal that may be signalled if the request is
  132. * to be aborted
  133. * @returns {Promise.<ArrayBuffer>}
  134. */
  135. getTileOrStrip(x: number, y: number, sample: number, poolOrDecoder: import("./geotiff").Pool | import("./geotiff").BaseDecoder, signal?: AbortSignal | undefined): Promise<ArrayBuffer>;
  136. /**
  137. * Internal read function.
  138. * @private
  139. * @param {Array} imageWindow The image window in pixel coordinates
  140. * @param {Array} samples The selected samples (0-based indices)
  141. * @param {TypedArray|TypedArray[]} valueArrays The array(s) to write into
  142. * @param {Boolean} interleave Whether or not to write in an interleaved manner
  143. * @param {import("./geotiff").Pool|AbstractDecoder} poolOrDecoder the decoder or decoder pool
  144. * @param {number} width the width of window to be read into
  145. * @param {number} height the height of window to be read into
  146. * @param {number} resampleMethod the resampling method to be used when interpolating
  147. * @param {AbortSignal} [signal] An AbortSignal that may be signalled if the request is
  148. * to be aborted
  149. * @returns {Promise<ReadRasterResult>}
  150. */
  151. private _readRaster;
  152. /**
  153. * Reads raster data from the image. This function reads all selected samples
  154. * into separate arrays of the correct type for that sample or into a single
  155. * combined array when `interleave` is set. When provided, only a subset
  156. * of the raster is read for each sample.
  157. *
  158. * @param {ReadRasterOptions} [options={}] optional parameters
  159. * @returns {Promise<ReadRasterResult>} the decoded arrays as a promise
  160. */
  161. readRasters({ window: wnd, samples, interleave, pool, width, height, resampleMethod, fillValue, signal, }?: ReadRasterOptions | undefined): Promise<ReadRasterResult>;
  162. /**
  163. * Reads raster data from the image as RGB. The result is always an
  164. * interleaved typed array.
  165. * Colorspaces other than RGB will be transformed to RGB, color maps expanded.
  166. * When no other method is applicable, the first sample is used to produce a
  167. * grayscale image.
  168. * When provided, only a subset of the raster is read for each sample.
  169. *
  170. * @param {Object} [options] optional parameters
  171. * @param {Array<number>} [options.window] the subset to read data from in pixels.
  172. * @param {boolean} [options.interleave=true] whether the data shall be read
  173. * in one single array or separate
  174. * arrays.
  175. * @param {import("./geotiff").Pool} [options.pool=null] The optional decoder pool to use.
  176. * @param {number} [options.width] The desired width of the output. When the width is no the
  177. * same as the images, resampling will be performed.
  178. * @param {number} [options.height] The desired height of the output. When the width is no the
  179. * same as the images, resampling will be performed.
  180. * @param {string} [options.resampleMethod='nearest'] The desired resampling method.
  181. * @param {boolean} [options.enableAlpha=false] Enable reading alpha channel if present.
  182. * @param {AbortSignal} [options.signal] An AbortSignal that may be signalled if the request is
  183. * to be aborted
  184. * @returns {Promise<ReadRasterResult>} the RGB array as a Promise
  185. */
  186. readRGB({ window, interleave, pool, width, height, resampleMethod, enableAlpha, signal }?: {
  187. window?: number[] | undefined;
  188. interleave?: boolean | undefined;
  189. pool?: import("./pool.js").default | undefined;
  190. width?: number | undefined;
  191. height?: number | undefined;
  192. resampleMethod?: string | undefined;
  193. enableAlpha?: boolean | undefined;
  194. signal?: AbortSignal | undefined;
  195. } | undefined): Promise<ReadRasterResult>;
  196. /**
  197. * Returns an array of tiepoints.
  198. * @returns {Object[]}
  199. */
  200. getTiePoints(): any[];
  201. /**
  202. * Returns the parsed GDAL metadata items.
  203. *
  204. * If sample is passed to null, dataset-level metadata will be returned.
  205. * Otherwise only metadata specific to the provided sample will be returned.
  206. *
  207. * @param {number} [sample=null] The sample index.
  208. * @returns {Object}
  209. */
  210. getGDALMetadata(sample?: number | undefined): any;
  211. /**
  212. * Returns the GDAL nodata value
  213. * @returns {number|null}
  214. */
  215. getGDALNoData(): number | null;
  216. /**
  217. * Returns the image origin as a XYZ-vector. When the image has no affine
  218. * transformation, then an exception is thrown.
  219. * @returns {Array<number>} The origin as a vector
  220. */
  221. getOrigin(): Array<number>;
  222. /**
  223. * Returns the image resolution as a XYZ-vector. When the image has no affine
  224. * transformation, then an exception is thrown.
  225. * @param {GeoTIFFImage} [referenceImage=null] A reference image to calculate the resolution from
  226. * in cases when the current image does not have the
  227. * required tags on its own.
  228. * @returns {Array<number>} The resolution as a vector
  229. */
  230. getResolution(referenceImage?: GeoTIFFImage | undefined): Array<number>;
  231. /**
  232. * Returns whether or not the pixels of the image depict an area (or point).
  233. * @returns {Boolean} Whether the pixels are a point
  234. */
  235. pixelIsArea(): boolean;
  236. /**
  237. * Returns the image bounding box as an array of 4 values: min-x, min-y,
  238. * max-x and max-y. When the image has no affine transformation, then an
  239. * exception is thrown.
  240. * @returns {Array<number>} The bounding box
  241. */
  242. getBoundingBox(): Array<number>;
  243. }
  244. //# sourceMappingURL=geotiffimage.d.ts.map