@cogeotiff/core 7.2.1 → 8.0.2
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/CHANGELOG.md +5 -502
- package/README.md +23 -11
- package/build/__benchmark__/cog.read.benchmark.d.ts +0 -1
- package/build/__benchmark__/cog.read.benchmark.js +6 -4
- package/build/__benchmark__/cog.read.benchmark.js.map +1 -0
- package/build/__benchmark__/source.file.d.ts +9 -0
- package/build/__benchmark__/source.file.js +29 -0
- package/build/__benchmark__/source.file.js.map +1 -0
- package/build/__benchmark__/source.memory.d.ts +9 -0
- package/build/__benchmark__/source.memory.js +32 -0
- package/build/__benchmark__/source.memory.js.map +1 -0
- package/build/__test__/cog.image.test.d.ts +1 -2
- package/build/__test__/cog.image.test.js +82 -90
- package/build/__test__/cog.image.test.js.map +1 -0
- package/build/__test__/cog.read.test.d.ts +1 -2
- package/build/__test__/cog.read.test.js +37 -55
- package/build/__test__/cog.read.test.js.map +1 -0
- package/build/__test__/example.d.ts +1 -0
- package/build/__test__/example.js +27 -0
- package/build/__test__/example.js.map +1 -0
- package/build/cog.tiff.d.ts +22 -28
- package/build/cog.tiff.image.d.ts +11 -23
- package/build/cog.tiff.image.js +108 -62
- package/build/cog.tiff.image.js.map +1 -0
- package/build/cog.tiff.js +141 -97
- package/build/cog.tiff.js.map +1 -0
- package/build/const/index.d.ts +1 -2
- package/build/const/index.js +2 -2
- package/build/const/index.js.map +1 -0
- package/build/const/tiff.endian.d.ts +0 -1
- package/build/const/tiff.endian.js +1 -1
- package/build/const/tiff.endian.js.map +1 -0
- package/build/const/tiff.mime.d.ts +10 -11
- package/build/const/tiff.mime.js +22 -22
- package/build/const/tiff.mime.js.map +1 -0
- package/build/const/tiff.tag.id.d.ts +3 -3
- package/build/const/tiff.tag.id.js +4 -3
- package/build/const/tiff.tag.id.js.map +1 -0
- package/build/const/tiff.tag.value.d.ts +15 -16
- package/build/const/tiff.tag.value.js +16 -16
- package/build/const/tiff.tag.value.js.map +1 -0
- package/build/const/tiff.version.d.ts +0 -1
- package/build/const/tiff.version.js +1 -1
- package/build/const/tiff.version.js.map +1 -0
- package/build/index.d.ts +11 -6
- package/build/index.js +9 -5
- package/build/index.js.map +1 -0
- package/build/read/data.view.offset.d.ts +15 -0
- package/build/read/data.view.offset.js +19 -0
- package/build/read/data.view.offset.js.map +1 -0
- package/build/read/tiff.gdal.d.ts +9 -12
- package/build/read/tiff.gdal.js +22 -17
- package/build/read/tiff.gdal.js.map +1 -0
- package/build/read/tiff.ifd.config.d.ts +6 -4
- package/build/read/tiff.ifd.config.js +2 -2
- package/build/read/tiff.ifd.config.js.map +1 -0
- package/build/read/tiff.tag.d.ts +40 -20
- package/build/read/tiff.tag.factory.d.ts +16 -0
- package/build/read/tiff.tag.factory.js +130 -0
- package/build/read/tiff.tag.factory.js.map +1 -0
- package/build/read/tiff.tag.js +2 -37
- package/build/read/tiff.tag.js.map +1 -0
- package/build/read/tiff.value.reader.d.ts +2 -6
- package/build/read/tiff.value.reader.js +16 -54
- package/build/read/tiff.value.reader.js.map +1 -0
- package/build/source.d.ts +5 -0
- package/build/source.js +2 -0
- package/build/source.js.map +1 -0
- package/build/util/bytes.d.ts +17 -0
- package/build/util/bytes.js +42 -0
- package/build/util/bytes.js.map +1 -0
- package/build/util/util.hex.d.ts +2 -3
- package/build/util/util.hex.js +4 -5
- package/build/util/util.hex.js.map +1 -0
- package/build/vector.d.ts +0 -1
- package/build/vector.js +1 -1
- package/build/vector.js.map +1 -0
- package/package.json +25 -30
- package/src/__benchmark__/cog.read.benchmark.ts +12 -10
- package/src/__benchmark__/source.file.ts +23 -0
- package/src/__benchmark__/source.memory.ts +23 -0
- package/src/__test__/cog.image.test.ts +188 -197
- package/src/__test__/cog.read.test.ts +50 -72
- package/src/__test__/example.ts +31 -0
- package/src/cog.tiff.image.ts +456 -447
- package/src/cog.tiff.ts +142 -145
- package/src/const/index.ts +1 -1
- package/src/const/tiff.endian.ts +2 -2
- package/src/const/tiff.mime.ts +21 -21
- package/src/const/tiff.tag.id.ts +157 -156
- package/src/const/tiff.tag.value.ts +16 -16
- package/src/const/tiff.version.ts +11 -11
- package/src/index.ts +11 -5
- package/src/read/data.view.offset.ts +23 -0
- package/src/read/tiff.gdal.ts +61 -63
- package/src/read/tiff.ifd.config.ts +35 -31
- package/src/read/tiff.tag.factory.ts +163 -0
- package/src/read/tiff.tag.ts +40 -38
- package/src/read/tiff.value.reader.ts +25 -73
- package/src/source.ts +5 -0
- package/src/util/bytes.ts +44 -0
- package/src/util/util.hex.ts +5 -7
- package/src/vector.ts +5 -5
- package/tsconfig.json +8 -8
- package/build/__benchmark__/cog.read.benchmark.d.ts.map +0 -1
- package/build/__test__/cog.image.test.d.ts.map +0 -1
- package/build/__test__/cog.read.test.d.ts.map +0 -1
- package/build/cog.tiff.d.ts.map +0 -1
- package/build/cog.tiff.image.d.ts.map +0 -1
- package/build/const/index.d.ts.map +0 -1
- package/build/const/tiff.endian.d.ts.map +0 -1
- package/build/const/tiff.mime.d.ts.map +0 -1
- package/build/const/tiff.tag.id.d.ts.map +0 -1
- package/build/const/tiff.tag.value.d.ts.map +0 -1
- package/build/const/tiff.version.d.ts.map +0 -1
- package/build/index.d.ts.map +0 -1
- package/build/read/tag/__test__/tag.test.d.ts +0 -2
- package/build/read/tag/__test__/tag.test.d.ts.map +0 -1
- package/build/read/tag/__test__/tag.test.js +0 -23
- package/build/read/tag/tiff.tag.base.d.ts +0 -55
- package/build/read/tag/tiff.tag.base.d.ts.map +0 -1
- package/build/read/tag/tiff.tag.base.js +0 -79
- package/build/read/tag/tiff.tag.lazy.d.ts +0 -7
- package/build/read/tag/tiff.tag.lazy.d.ts.map +0 -1
- package/build/read/tag/tiff.tag.lazy.js +0 -18
- package/build/read/tag/tiff.tag.offset.d.ts +0 -21
- package/build/read/tag/tiff.tag.offset.d.ts.map +0 -1
- package/build/read/tag/tiff.tag.offset.js +0 -54
- package/build/read/tag/tiff.tag.static.d.ts +0 -8
- package/build/read/tag/tiff.tag.static.d.ts.map +0 -1
- package/build/read/tag/tiff.tag.static.js +0 -17
- package/build/read/tiff.gdal.d.ts.map +0 -1
- package/build/read/tiff.ifd.config.d.ts.map +0 -1
- package/build/read/tiff.tag.d.ts.map +0 -1
- package/build/read/tiff.value.reader.d.ts.map +0 -1
- package/build/source/cog.source.view.d.ts +0 -33
- package/build/source/cog.source.view.d.ts.map +0 -1
- package/build/source/cog.source.view.js +0 -65
- package/build/util/util.hex.d.ts.map +0 -1
- package/build/vector.d.ts.map +0 -1
- package/src/@types/ieee754.d.ts +0 -18
- package/src/read/tag/__test__/tag.test.ts +0 -27
- package/src/read/tag/tiff.tag.base.ts +0 -126
- package/src/read/tag/tiff.tag.lazy.ts +0 -17
- package/src/read/tag/tiff.tag.offset.ts +0 -61
- package/src/read/tag/tiff.tag.static.ts +0 -15
- package/src/source/cog.source.view.ts +0 -77
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { CogTiffTagBase } from './tiff.tag.base.js';
|
|
2
|
-
|
|
3
|
-
export class CogTifTagStatic<T> extends CogTiffTagBase<T> {
|
|
4
|
-
_isRead = false;
|
|
5
|
-
_value: T | null = null;
|
|
6
|
-
|
|
7
|
-
/** Lazy read the inline tiff tags */
|
|
8
|
-
get value(): T {
|
|
9
|
-
if (this._isRead === false) {
|
|
10
|
-
this._value = this.readValue();
|
|
11
|
-
this._isRead = true;
|
|
12
|
-
}
|
|
13
|
-
return this._value as T;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { ByteSize } from '@chunkd/core';
|
|
2
|
-
import * as ieee754 from 'ieee754';
|
|
3
|
-
import { CogTiff } from '../cog.tiff.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* View of a Cog source used for reading bytes from the cog while keeping
|
|
7
|
-
* track of the offset
|
|
8
|
-
*/
|
|
9
|
-
export class CogSourceCursor {
|
|
10
|
-
private tiff: CogTiff;
|
|
11
|
-
/** Starting offset for the view */
|
|
12
|
-
byteOffset: number;
|
|
13
|
-
/** number of bytes that have been read since starting */
|
|
14
|
-
relativeOffset: number;
|
|
15
|
-
|
|
16
|
-
constructor(tiff: CogTiff, offset = 0) {
|
|
17
|
-
this.tiff = tiff;
|
|
18
|
-
this.byteOffset = offset;
|
|
19
|
-
this.relativeOffset = 0;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/** current offset after all the reads */
|
|
23
|
-
get currentOffset(): number {
|
|
24
|
-
return this.byteOffset + this.relativeOffset;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/** Seek to a position */
|
|
28
|
-
seekTo(offset: number): CogSourceCursor {
|
|
29
|
-
this.byteOffset = offset;
|
|
30
|
-
this.relativeOffset = 0;
|
|
31
|
-
return this;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* @param count number of bytes to move
|
|
36
|
-
* @returns the offset that we seeked from
|
|
37
|
-
*/
|
|
38
|
-
seek(count: number): number {
|
|
39
|
-
const startOffset = this.currentOffset;
|
|
40
|
-
this.relativeOffset += count;
|
|
41
|
-
return startOffset;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
bytes(count: number): Uint8Array {
|
|
45
|
-
return this.tiff.source.bytes(this.seek(count), count);
|
|
46
|
-
}
|
|
47
|
-
uint(size: number): number {
|
|
48
|
-
return this.tiff.source.getUint(this.seek(size), size);
|
|
49
|
-
}
|
|
50
|
-
uint8(): number {
|
|
51
|
-
return this.tiff.source.getUint8(this.seek(ByteSize.UInt8));
|
|
52
|
-
}
|
|
53
|
-
uint16(): number {
|
|
54
|
-
return this.tiff.source.getUint16(this.seek(ByteSize.UInt16));
|
|
55
|
-
}
|
|
56
|
-
uint32(): number {
|
|
57
|
-
return this.tiff.source.getUint32(this.seek(ByteSize.UInt32));
|
|
58
|
-
}
|
|
59
|
-
uint64(): number {
|
|
60
|
-
return this.tiff.source.getUint64(this.seek(ByteSize.UInt64));
|
|
61
|
-
}
|
|
62
|
-
pointer(): number {
|
|
63
|
-
const pointerSize = this.tiff.ifdConfig.pointer;
|
|
64
|
-
return this.tiff.source.getUint(this.seek(pointerSize), pointerSize);
|
|
65
|
-
}
|
|
66
|
-
offset(): number {
|
|
67
|
-
const offsetSize = this.tiff.ifdConfig.offset;
|
|
68
|
-
return this.tiff.source.getUint(this.seek(offsetSize), offsetSize);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
float(): number {
|
|
72
|
-
return ieee754.read(this.bytes(ByteSize.Float), 0, this.tiff.source.isLittleEndian, 23, 4);
|
|
73
|
-
}
|
|
74
|
-
double(): number {
|
|
75
|
-
return ieee754.read(this.bytes(ByteSize.Double), 0, this.tiff.source.isLittleEndian, 52, 8);
|
|
76
|
-
}
|
|
77
|
-
}
|