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.
- package/README.md +67 -0
- package/dist-browser/geotiff.js +2 -2
- package/dist-browser/geotiff.js.map +1 -1
- package/dist-module/compression/index.d.ts +3 -3
- package/dist-module/compression/index.d.ts.map +1 -1
- package/dist-module/compression/index.js +6 -6
- package/dist-module/geotiff.d.ts +16 -18
- package/dist-module/geotiff.d.ts.map +1 -1
- package/dist-module/geotiff.js +14 -14
- package/dist-module/geotiff.js.map +1 -1
- package/dist-module/geotiffimage.d.ts +28 -28
- package/dist-module/geotiffimage.d.ts.map +1 -1
- package/dist-module/geotiffimage.js +25 -23
- package/dist-module/geotiffimage.js.map +1 -1
- package/dist-module/geotiffwriter.d.ts.map +1 -1
- package/dist-module/geotiffwriter.js +50 -8
- package/dist-module/geotiffwriter.js.map +1 -1
- package/dist-module/globals.d.ts +4 -0
- package/dist-module/globals.d.ts.map +1 -1
- package/dist-module/globals.js +4 -0
- package/dist-module/globals.js.map +1 -1
- package/dist-module/imagefiledirectory.d.ts +3 -7
- package/dist-module/imagefiledirectory.d.ts.map +1 -1
- package/dist-module/imagefiledirectory.js +2 -4
- package/dist-module/imagefiledirectory.js.map +1 -1
- package/dist-module/resample.d.ts +18 -18
- package/dist-module/resample.d.ts.map +1 -1
- package/dist-module/resample.js +13 -13
- package/dist-module/rgb.d.ts +1 -1
- package/dist-module/rgb.d.ts.map +1 -1
- package/dist-module/source/blockedsource.d.ts +7 -7
- package/dist-module/source/blockedsource.d.ts.map +1 -1
- package/dist-module/source/blockedsource.js +5 -5
- package/dist-module/source/remote.d.ts +32 -6
- package/dist-module/source/remote.d.ts.map +1 -1
- package/dist-module/source/remote.js +15 -4
- package/dist-module/source/remote.js.map +1 -1
- package/dist-node/compression/index.d.ts +3 -3
- package/dist-node/compression/index.d.ts.map +1 -1
- package/dist-node/compression/index.js +6 -6
- package/dist-node/geotiff.d.ts +16 -18
- package/dist-node/geotiff.d.ts.map +1 -1
- package/dist-node/geotiff.js +14 -14
- package/dist-node/geotiff.js.map +1 -1
- package/dist-node/geotiffimage.d.ts +28 -28
- package/dist-node/geotiffimage.d.ts.map +1 -1
- package/dist-node/geotiffimage.js +25 -23
- package/dist-node/geotiffimage.js.map +1 -1
- package/dist-node/geotiffwriter.d.ts.map +1 -1
- package/dist-node/geotiffwriter.js +50 -8
- package/dist-node/geotiffwriter.js.map +1 -1
- package/dist-node/globals.d.ts +4 -0
- package/dist-node/globals.d.ts.map +1 -1
- package/dist-node/globals.js +4 -0
- package/dist-node/globals.js.map +1 -1
- package/dist-node/imagefiledirectory.d.ts +3 -7
- package/dist-node/imagefiledirectory.d.ts.map +1 -1
- package/dist-node/imagefiledirectory.js +2 -4
- package/dist-node/imagefiledirectory.js.map +1 -1
- package/dist-node/resample.d.ts +18 -18
- package/dist-node/resample.d.ts.map +1 -1
- package/dist-node/resample.js +13 -13
- package/dist-node/source/blockedsource.d.ts +7 -7
- package/dist-node/source/blockedsource.d.ts.map +1 -1
- package/dist-node/source/blockedsource.js +5 -5
- package/dist-node/source/remote.d.ts +32 -6
- package/dist-node/source/remote.d.ts.map +1 -1
- package/dist-node/source/remote.js +15 -4
- package/dist-node/source/remote.js.map +1 -1
- package/package.json +1 -1
- package/src/compression/index.js +6 -6
- package/src/geotiff.js +14 -15
- package/src/geotiffimage.js +25 -23
- package/src/geotiffwriter.js +52 -9
- package/src/globals.js +4 -0
- package/src/imagefiledirectory.js +2 -4
- package/src/resample.js +13 -13
- package/src/rgb.ts +1 -1
- package/src/source/blockedsource.js +5 -5
- 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
|