geotiff 3.0.4 → 3.1.0-beta.0

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.
Files changed (80) hide show
  1. package/README.md +67 -0
  2. package/dist-browser/geotiff.js +2 -2
  3. package/dist-browser/geotiff.js.map +1 -1
  4. package/dist-module/compression/index.d.ts +3 -3
  5. package/dist-module/compression/index.d.ts.map +1 -1
  6. package/dist-module/compression/index.js +6 -6
  7. package/dist-module/geotiff.d.ts +16 -18
  8. package/dist-module/geotiff.d.ts.map +1 -1
  9. package/dist-module/geotiff.js +14 -14
  10. package/dist-module/geotiff.js.map +1 -1
  11. package/dist-module/geotiffimage.d.ts +28 -28
  12. package/dist-module/geotiffimage.d.ts.map +1 -1
  13. package/dist-module/geotiffimage.js +25 -23
  14. package/dist-module/geotiffimage.js.map +1 -1
  15. package/dist-module/geotiffwriter.d.ts.map +1 -1
  16. package/dist-module/geotiffwriter.js +50 -8
  17. package/dist-module/geotiffwriter.js.map +1 -1
  18. package/dist-module/globals.d.ts +4 -0
  19. package/dist-module/globals.d.ts.map +1 -1
  20. package/dist-module/globals.js +4 -0
  21. package/dist-module/globals.js.map +1 -1
  22. package/dist-module/imagefiledirectory.d.ts +3 -7
  23. package/dist-module/imagefiledirectory.d.ts.map +1 -1
  24. package/dist-module/imagefiledirectory.js +2 -4
  25. package/dist-module/imagefiledirectory.js.map +1 -1
  26. package/dist-module/resample.d.ts +18 -18
  27. package/dist-module/resample.d.ts.map +1 -1
  28. package/dist-module/resample.js +13 -13
  29. package/dist-module/rgb.d.ts +1 -1
  30. package/dist-module/rgb.d.ts.map +1 -1
  31. package/dist-module/source/blockedsource.d.ts +7 -7
  32. package/dist-module/source/blockedsource.d.ts.map +1 -1
  33. package/dist-module/source/blockedsource.js +5 -5
  34. package/dist-module/source/remote.d.ts +32 -6
  35. package/dist-module/source/remote.d.ts.map +1 -1
  36. package/dist-module/source/remote.js +15 -4
  37. package/dist-module/source/remote.js.map +1 -1
  38. package/dist-node/compression/index.d.ts +3 -3
  39. package/dist-node/compression/index.d.ts.map +1 -1
  40. package/dist-node/compression/index.js +6 -6
  41. package/dist-node/geotiff.d.ts +16 -18
  42. package/dist-node/geotiff.d.ts.map +1 -1
  43. package/dist-node/geotiff.js +14 -14
  44. package/dist-node/geotiff.js.map +1 -1
  45. package/dist-node/geotiffimage.d.ts +28 -28
  46. package/dist-node/geotiffimage.d.ts.map +1 -1
  47. package/dist-node/geotiffimage.js +25 -23
  48. package/dist-node/geotiffimage.js.map +1 -1
  49. package/dist-node/geotiffwriter.d.ts.map +1 -1
  50. package/dist-node/geotiffwriter.js +50 -8
  51. package/dist-node/geotiffwriter.js.map +1 -1
  52. package/dist-node/globals.d.ts +4 -0
  53. package/dist-node/globals.d.ts.map +1 -1
  54. package/dist-node/globals.js +4 -0
  55. package/dist-node/globals.js.map +1 -1
  56. package/dist-node/imagefiledirectory.d.ts +3 -7
  57. package/dist-node/imagefiledirectory.d.ts.map +1 -1
  58. package/dist-node/imagefiledirectory.js +2 -4
  59. package/dist-node/imagefiledirectory.js.map +1 -1
  60. package/dist-node/resample.d.ts +18 -18
  61. package/dist-node/resample.d.ts.map +1 -1
  62. package/dist-node/resample.js +13 -13
  63. package/dist-node/source/blockedsource.d.ts +7 -7
  64. package/dist-node/source/blockedsource.d.ts.map +1 -1
  65. package/dist-node/source/blockedsource.js +5 -5
  66. package/dist-node/source/remote.d.ts +32 -6
  67. package/dist-node/source/remote.d.ts.map +1 -1
  68. package/dist-node/source/remote.js +15 -4
  69. package/dist-node/source/remote.js.map +1 -1
  70. package/package.json +1 -1
  71. package/src/compression/index.js +6 -6
  72. package/src/geotiff.js +14 -15
  73. package/src/geotiffimage.js +25 -23
  74. package/src/geotiffwriter.js +52 -9
  75. package/src/globals.js +4 -0
  76. package/src/imagefiledirectory.js +2 -4
  77. package/src/resample.js +13 -13
  78. package/src/rgb.ts +1 -1
  79. package/src/source/blockedsource.js +5 -5
  80. package/src/source/remote.js +16 -4
package/README.md CHANGED
@@ -711,6 +711,73 @@ const metadata = {
711
711
  const arrayBuffer = await writeArrayBuffer(values, metadata);
712
712
  ```
713
713
 
714
+ To write geotiffs with multiple strips by specifying the metadata for `StripByteCounts` and `RowsPerStrip`:
715
+ ```javascript
716
+ const originalRed = [
717
+ [255, 255, 255],
718
+ [0, 0, 0],
719
+ [0, 0, 0],
720
+ ];
721
+ const originalGreen = [
722
+ [0, 0, 0],
723
+ [255, 255, 255],
724
+ [0, 0, 0],
725
+ ];
726
+ const originalBlue = [
727
+ [0, 0, 0],
728
+ [0, 0, 0],
729
+ [255, 255, 255],
730
+ ];
731
+ const interleaved = originalRed.flatMap((row, rowIdx) => row.flatMap((value, colIdx) => [
732
+ value, originalGreen[rowIdx][colIdx], originalBlue[rowIdx][colIdx],
733
+ ]));
734
+ const values = new Uint8Array(interleaved);
735
+ const metadata = {
736
+ height: 3,
737
+ width: 3,
738
+ RowsPerStrip: 1,
739
+ StripByteCounts: [9, 9, 9],
740
+ };
741
+
742
+ const newGeoTiffAsBinaryData = await writeArrayBuffer(values, metadata);
743
+ ```
744
+
745
+ To create tiled geotiffs, specify the metadata for: `TileByteCounts`, `TileWidth`, `TileLength` and `SamplesPerPixel`:
746
+ ```javascript
747
+ const originalRed = [
748
+ [255, 255, 255],
749
+ [1, 1, 1],
750
+ [1, 1, 1],
751
+ ];
752
+ const originalGreen = [
753
+ [1, 1, 1],
754
+ [255, 255, 255],
755
+ [1, 1, 1],
756
+ ];
757
+ const originalBlue = [
758
+ [1, 1, 1],
759
+ [1, 1, 1],
760
+ [255, 255, 255],
761
+ ];
762
+
763
+ const tileHeight = 2;
764
+ const tileWidth = 2;
765
+ const height = 3;
766
+ const width = 3;
767
+ const samplesPerPixel = 3;
768
+
769
+ // You must provide your own flattenAndPadTiledDataInterleaved implementation, bear in mind partial tiles must be padded with null bytes
770
+ const tiled = flattenAndPadTiledDataInterleaved(interleaved, width, height, tileWidth, tileHeight, samplesPerPixel);
771
+ const metadata = {
772
+ height,
773
+ width,
774
+ TileByteCounts: [12, 12, 12, 12],
775
+ TileWidth: tileWidth,
776
+ TileLength: tileHeight,
777
+ SamplesPerPixel: samplesPerPixel,
778
+ };
779
+ ```
780
+
714
781
  ## What to do with the data?
715
782
 
716
783
  There is a nice HTML 5/WebGL based rendering library called