@cogeotiff/core 7.2.0 → 8.0.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.
Files changed (147) hide show
  1. package/CHANGELOG.md +3 -500
  2. package/README.md +28 -10
  3. package/build/__benchmark__/cog.read.benchmark.d.ts +0 -1
  4. package/build/__benchmark__/cog.read.benchmark.js +6 -4
  5. package/build/__benchmark__/cog.read.benchmark.js.map +1 -0
  6. package/build/__benchmark__/source.file.d.ts +9 -0
  7. package/build/__benchmark__/source.file.js +29 -0
  8. package/build/__benchmark__/source.file.js.map +1 -0
  9. package/build/__benchmark__/source.memory.d.ts +9 -0
  10. package/build/__benchmark__/source.memory.js +32 -0
  11. package/build/__benchmark__/source.memory.js.map +1 -0
  12. package/build/__test__/cog.image.test.d.ts +1 -2
  13. package/build/__test__/cog.image.test.js +82 -90
  14. package/build/__test__/cog.image.test.js.map +1 -0
  15. package/build/__test__/cog.read.test.d.ts +1 -2
  16. package/build/__test__/cog.read.test.js +37 -55
  17. package/build/__test__/cog.read.test.js.map +1 -0
  18. package/build/__test__/example.d.ts +1 -0
  19. package/build/__test__/example.js +27 -0
  20. package/build/__test__/example.js.map +1 -0
  21. package/build/cog.tiff.d.ts +22 -28
  22. package/build/cog.tiff.image.d.ts +16 -28
  23. package/build/cog.tiff.image.js +147 -101
  24. package/build/cog.tiff.image.js.map +1 -0
  25. package/build/cog.tiff.js +141 -97
  26. package/build/cog.tiff.js.map +1 -0
  27. package/build/const/index.d.ts +1 -2
  28. package/build/const/index.js +2 -2
  29. package/build/const/index.js.map +1 -0
  30. package/build/const/tiff.endian.d.ts +0 -1
  31. package/build/const/tiff.endian.js +1 -1
  32. package/build/const/tiff.endian.js.map +1 -0
  33. package/build/const/tiff.mime.d.ts +10 -11
  34. package/build/const/tiff.mime.js +22 -22
  35. package/build/const/tiff.mime.js.map +1 -0
  36. package/build/const/tiff.tag.id.d.ts +5 -5
  37. package/build/const/tiff.tag.id.js +155 -154
  38. package/build/const/tiff.tag.id.js.map +1 -0
  39. package/build/const/tiff.tag.value.d.ts +15 -16
  40. package/build/const/tiff.tag.value.js +16 -16
  41. package/build/const/tiff.tag.value.js.map +1 -0
  42. package/build/const/tiff.version.d.ts +0 -1
  43. package/build/const/tiff.version.js +1 -1
  44. package/build/const/tiff.version.js.map +1 -0
  45. package/build/index.d.ts +11 -6
  46. package/build/index.js +9 -5
  47. package/build/index.js.map +1 -0
  48. package/build/read/data.view.offset.d.ts +15 -0
  49. package/build/read/data.view.offset.js +19 -0
  50. package/build/read/data.view.offset.js.map +1 -0
  51. package/build/read/tiff.gdal.d.ts +9 -12
  52. package/build/read/tiff.gdal.js +22 -17
  53. package/build/read/tiff.gdal.js.map +1 -0
  54. package/build/read/tiff.ifd.config.d.ts +6 -4
  55. package/build/read/tiff.ifd.config.js +2 -2
  56. package/build/read/tiff.ifd.config.js.map +1 -0
  57. package/build/read/tiff.tag.d.ts +37 -20
  58. package/build/read/tiff.tag.factory.d.ts +16 -0
  59. package/build/read/tiff.tag.factory.js +130 -0
  60. package/build/read/tiff.tag.factory.js.map +1 -0
  61. package/build/read/tiff.tag.js +2 -37
  62. package/build/read/tiff.tag.js.map +1 -0
  63. package/build/read/tiff.value.reader.d.ts +2 -6
  64. package/build/read/tiff.value.reader.js +16 -54
  65. package/build/read/tiff.value.reader.js.map +1 -0
  66. package/build/source.d.ts +5 -0
  67. package/build/source.js +2 -0
  68. package/build/source.js.map +1 -0
  69. package/build/util/bytes.d.ts +17 -0
  70. package/build/util/bytes.js +42 -0
  71. package/build/util/bytes.js.map +1 -0
  72. package/build/util/util.hex.d.ts +2 -3
  73. package/build/util/util.hex.js +4 -5
  74. package/build/util/util.hex.js.map +1 -0
  75. package/build/vector.d.ts +0 -1
  76. package/build/vector.js +1 -1
  77. package/build/vector.js.map +1 -0
  78. package/package.json +25 -30
  79. package/src/__benchmark__/cog.read.benchmark.ts +12 -10
  80. package/src/__benchmark__/source.file.ts +23 -0
  81. package/src/__benchmark__/source.memory.ts +23 -0
  82. package/src/__test__/cog.image.test.ts +188 -197
  83. package/src/__test__/cog.read.test.ts +50 -72
  84. package/src/__test__/example.ts +31 -0
  85. package/src/cog.tiff.image.ts +456 -448
  86. package/src/cog.tiff.ts +143 -146
  87. package/src/const/index.ts +1 -1
  88. package/src/const/tiff.endian.ts +2 -2
  89. package/src/const/tiff.mime.ts +21 -21
  90. package/src/const/tiff.tag.id.ts +159 -158
  91. package/src/const/tiff.tag.value.ts +16 -16
  92. package/src/const/tiff.version.ts +11 -11
  93. package/src/index.ts +11 -5
  94. package/src/read/data.view.offset.ts +23 -0
  95. package/src/read/tiff.gdal.ts +61 -63
  96. package/src/read/tiff.ifd.config.ts +35 -31
  97. package/src/read/tiff.tag.factory.ts +163 -0
  98. package/src/read/tiff.tag.ts +38 -39
  99. package/src/read/tiff.value.reader.ts +25 -73
  100. package/src/source.ts +5 -0
  101. package/src/util/bytes.ts +44 -0
  102. package/src/util/util.hex.ts +5 -7
  103. package/src/vector.ts +5 -5
  104. package/tsconfig.json +8 -10
  105. package/build/__benchmark__/cog.read.benchmark.d.ts.map +0 -1
  106. package/build/__test__/cog.image.test.d.ts.map +0 -1
  107. package/build/__test__/cog.read.test.d.ts.map +0 -1
  108. package/build/cog.tiff.d.ts.map +0 -1
  109. package/build/cog.tiff.image.d.ts.map +0 -1
  110. package/build/const/index.d.ts.map +0 -1
  111. package/build/const/tiff.endian.d.ts.map +0 -1
  112. package/build/const/tiff.mime.d.ts.map +0 -1
  113. package/build/const/tiff.tag.id.d.ts.map +0 -1
  114. package/build/const/tiff.tag.value.d.ts.map +0 -1
  115. package/build/const/tiff.version.d.ts.map +0 -1
  116. package/build/index.d.ts.map +0 -1
  117. package/build/read/tag/__test__/tag.test.d.ts +0 -2
  118. package/build/read/tag/__test__/tag.test.d.ts.map +0 -1
  119. package/build/read/tag/__test__/tag.test.js +0 -23
  120. package/build/read/tag/tiff.tag.base.d.ts +0 -55
  121. package/build/read/tag/tiff.tag.base.d.ts.map +0 -1
  122. package/build/read/tag/tiff.tag.base.js +0 -79
  123. package/build/read/tag/tiff.tag.lazy.d.ts +0 -7
  124. package/build/read/tag/tiff.tag.lazy.d.ts.map +0 -1
  125. package/build/read/tag/tiff.tag.lazy.js +0 -18
  126. package/build/read/tag/tiff.tag.offset.d.ts +0 -21
  127. package/build/read/tag/tiff.tag.offset.d.ts.map +0 -1
  128. package/build/read/tag/tiff.tag.offset.js +0 -54
  129. package/build/read/tag/tiff.tag.static.d.ts +0 -8
  130. package/build/read/tag/tiff.tag.static.d.ts.map +0 -1
  131. package/build/read/tag/tiff.tag.static.js +0 -17
  132. package/build/read/tiff.gdal.d.ts.map +0 -1
  133. package/build/read/tiff.ifd.config.d.ts.map +0 -1
  134. package/build/read/tiff.tag.d.ts.map +0 -1
  135. package/build/read/tiff.value.reader.d.ts.map +0 -1
  136. package/build/source/cog.source.view.d.ts +0 -33
  137. package/build/source/cog.source.view.d.ts.map +0 -1
  138. package/build/source/cog.source.view.js +0 -65
  139. package/build/util/util.hex.d.ts.map +0 -1
  140. package/build/vector.d.ts.map +0 -1
  141. package/src/@types/ieee754.d.ts +0 -18
  142. package/src/read/tag/__test__/tag.test.ts +0 -27
  143. package/src/read/tag/tiff.tag.base.ts +0 -126
  144. package/src/read/tag/tiff.tag.lazy.ts +0 -17
  145. package/src/read/tag/tiff.tag.offset.ts +0 -61
  146. package/src/read/tag/tiff.tag.static.ts +0 -15
  147. package/src/source/cog.source.view.ts +0 -77
package/CHANGELOG.md CHANGED
@@ -1,505 +1,8 @@
1
- # Change Log
1
+ # Changelog
2
2
 
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- # [7.2.0](https://github.com/blacha/cogeotiff/compare/v7.1.0...v7.2.0) (2022-08-23)
7
-
8
-
9
- ### Bug Fixes
10
-
11
- * **core:** sometimes MASK_INTERLEAVED_WITH_IMAGERY is prefixed with a space so trim it ([5002e22](https://github.com/blacha/cogeotiff/commit/5002e22bdd0a6480d210d89ce6878b3e4df0efd9))
12
-
13
-
14
- ### Features
15
-
16
- * **core:** add zstd compression ([c9f9c4c](https://github.com/blacha/cogeotiff/commit/c9f9c4cf342a7e72657ee2481e600273c0e166c5))
17
- * **core:** import LERC, LZMA and JpegXL compression types ([49af971](https://github.com/blacha/cogeotiff/commit/49af9716f0400643be2085a933d2db2b8a988226))
18
-
19
-
20
-
21
-
22
-
23
- # [7.1.0](https://github.com/blacha/cogeotiff/compare/v7.0.0...v7.1.0) (2022-06-22)
24
-
25
-
26
- ### Bug Fixes
27
-
28
- * **core:** load the ghost header bytes if requested ([b1f0116](https://github.com/blacha/cogeotiff/commit/b1f01164da1ad7deed7c3754e0106ccfea773338))
29
-
30
-
31
- ### Features
32
-
33
- * **core:** add hasTile function to determine if a tile exists in a sparse tiff ([e56a67c](https://github.com/blacha/cogeotiff/commit/e56a67cc078945c5d96ddd3e6aefbf2d773359a4))
34
-
35
-
36
- ### Performance Improvements
37
-
38
- * **core:** improve parsing of ghost options ([ffa7928](https://github.com/blacha/cogeotiff/commit/ffa79283a61efd6f9999bd43d222faa24cd5ced7))
39
- * greatly increase the amount of tiles being read so nodejs startup time affects the timing less ([3e9c0f3](https://github.com/blacha/cogeotiff/commit/3e9c0f305584d95fd79e1fe094477f3589b235c6))
40
- * **core:** improve lookup speed of ghost options ([7c5f37e](https://github.com/blacha/cogeotiff/commit/7c5f37e114a77a772ca588e62b6d22712d05b2bc))
41
-
42
-
43
-
44
-
45
-
46
- # [7.0.0](https://github.com/blacha/cogeotiff/compare/v6.1.1...v7.0.0) (2022-03-17)
47
-
48
-
49
- ### Features
50
-
51
- * **core:** upgrade chunkd and remove logger for internal fetches ([#832](https://github.com/blacha/cogeotiff/issues/832)) ([71bd740](https://github.com/blacha/cogeotiff/commit/71bd7409706e4a82e6a29b2a3fc0e8b25221e9fc))
52
-
53
-
54
-
55
-
56
-
57
- ## [6.1.1](https://github.com/blacha/cogeotiff/compare/v6.1.0...v6.1.1) (2022-01-26)
58
-
59
-
60
- ### Bug Fixes
61
-
62
- * **core:** tag data count should be a uint32 for tiff not uint16 ([5e0f66c](https://github.com/blacha/cogeotiff/commit/5e0f66c213db265d83d976424b6a443be6afbe73))
63
-
64
-
65
-
66
-
67
-
68
- # [6.1.0](https://github.com/blacha/cogeotiff/compare/v6.0.2...v6.1.0) (2021-09-30)
69
-
70
-
71
- ### Features
72
-
73
- * **core:** support no compression ([f1f8762](https://github.com/blacha/cogeotiff/commit/f1f8762d6b5a4b2b8eae7f472bd70f0216138be8))
74
-
75
-
76
-
77
-
78
-
79
- ## [6.0.2](https://github.com/blacha/cogeotiff/compare/v6.0.1...v6.0.2) (2021-09-16)
80
-
81
-
82
- ### Bug Fixes
83
-
84
- * upgrade to latest chunkd fixes issue with missing fetchBytes function ([9b33cbf](https://github.com/blacha/cogeotiff/commit/9b33cbfe02acaa1248895203c1a55002b82d1a49))
85
-
86
-
87
-
88
-
89
-
90
- ## [6.0.1](https://github.com/blacha/cogeotiff/compare/v6.0.0...v6.0.1) (2021-09-15)
91
-
92
- **Note:** Version bump only for package @cogeotiff/core
93
-
94
-
95
-
96
-
97
-
98
- # [6.0.0](https://github.com/blacha/cogeotiff/compare/v5.0.0...v6.0.0) (2021-09-11)
99
-
100
-
101
- ### Features
102
-
103
- * package with esm modules ([#738](https://github.com/blacha/cogeotiff/issues/738)) ([ac0b4f0](https://github.com/blacha/cogeotiff/commit/ac0b4f0932538a55ccc2d22bba94b8bf23dba27a))
104
-
105
-
106
- ### BREAKING CHANGES
107
-
108
- * this changes the module system to ESM which breaks compatibility with require
109
-
110
-
111
-
112
-
113
-
114
- # [5.0.0](https://github.com/blacha/cogeotiff/compare/v4.4.0...v5.0.0) (2021-07-23)
115
-
116
-
117
- ### Features
118
-
119
- * extract all chunk source logic into `@chunkd/*` ([#723](https://github.com/blacha/cogeotiff/issues/723)) ([fa42393](https://github.com/blacha/cogeotiff/commit/fa4239358b11821b21fc78652b0744bc3c839c06))
120
-
121
-
122
-
123
-
124
-
125
- # [4.3.0](https://github.com/blacha/cogeotiff/compare/v4.2.0...v4.3.0) (2021-06-22)
126
-
127
-
128
- ### Features
129
-
130
- * **chunk:** expose a in memory chunk reader ([a550682](https://github.com/blacha/cogeotiff/commit/a5506820569d8e56f1a28648b78d86aa61d7e453))
131
-
132
-
133
-
134
-
135
-
136
- # [4.2.0](https://github.com/blacha/cogeotiff/compare/v4.1.2...v4.2.0) (2021-03-25)
137
-
138
-
139
- ### Features
140
-
141
- * **chunk:** add ability to read entire file using .read() ([#664](https://github.com/blacha/cogeotiff/issues/664)) ([4db04ad](https://github.com/blacha/cogeotiff/commit/4db04adc43ab4c358526e469c712f7958381d738))
142
-
143
-
144
-
145
-
146
-
147
- ## [4.1.2](https://github.com/blacha/cogeotiff/compare/v4.1.1...v4.1.2) (2021-03-18)
148
-
149
-
150
- ### Bug Fixes
151
-
152
- * **core:** lazy tags should cache the lazy value ([a30c0e1](https://github.com/blacha/cogeotiff/commit/a30c0e1b976cdf4956b2d962d1cfafdf0f74dce0))
153
- * **core:** load additional bytes for ifdReading if needed ([d59bf2d](https://github.com/blacha/cogeotiff/commit/d59bf2d383d8748ba13dabd8915ea11bcb46adeb))
154
-
155
-
156
-
157
-
158
-
159
- ## [4.1.1](https://github.com/blacha/cogeotiff/compare/v4.1.0...v4.1.1) (2021-03-10)
160
-
161
-
162
- ### Bug Fixes
163
-
164
- * **core:** actually fetch bytes when needed by a lazy tag loader ([0cb8e50](https://github.com/blacha/cogeotiff/commit/0cb8e5074d6753809c00def18dd6d900923b9085))
165
-
166
-
167
-
168
-
169
-
170
- # [4.1.0](https://github.com/blacha/cogeotiff/compare/v4.0.0...v4.1.0) (2021-02-23)
171
-
172
-
173
- ### Features
174
-
175
- * **core:** allow CogTiff.init to be called multiple times ([4a8ab20](https://github.com/blacha/cogeotiff/commit/4a8ab20946bb72121d080300c42404933d42fe06))
176
- * **web:** support rendering in leaflet maps ([#482](https://github.com/blacha/cogeotiff/issues/482)) ([dfb40fa](https://github.com/blacha/cogeotiff/commit/dfb40fad836d4e762bd2485a435ac402fcf1c3d6))
177
-
178
-
179
-
180
-
181
-
182
- # [4.0.0](https://github.com/blacha/cogeotiff/compare/v3.1.0...v4.0.0) (2021-02-02)
183
-
184
- **Note:** Version bump only for package @cogeotiff/core
185
-
186
-
187
-
188
-
189
-
190
- # [3.1.0](https://github.com/blacha/coginfo/compare/v3.0.0...v3.1.0) (2021-01-18)
191
-
192
-
193
- ### Features
194
-
195
- * **cli:** support cogs that are not geolocated ([#632](https://github.com/blacha/coginfo/issues/632)) ([da73964](https://github.com/blacha/coginfo/commit/da73964944620dd32094eab14e475225de021857))
196
-
197
-
198
-
199
-
200
-
201
- # [3.0.0](https://github.com/blacha/coginfo/compare/v2.2.0...v3.0.0) (2020-10-30)
202
-
203
- **Note:** Version bump only for package @cogeotiff/core
204
-
205
-
206
-
207
-
208
-
209
- # [2.2.0](https://github.com/blacha/coginfo/compare/v2.1.1...v2.2.0) (2020-07-01)
210
-
211
-
212
- ### Features
213
-
214
- * adding uri for a full reference for any source ([#469](https://github.com/blacha/coginfo/issues/469)) ([137d9c9](https://github.com/blacha/coginfo/commit/137d9c9))
215
-
216
-
217
-
218
-
219
-
220
- ## [2.1.1](https://github.com/blacha/coginfo/compare/v2.1.0...v2.1.1) (2020-06-25)
221
-
222
-
223
- ### Bug Fixes
224
-
225
- * **core:** sparse cogs should return null for sparse tiles ([#466](https://github.com/blacha/coginfo/issues/466)) ([322c4d1](https://github.com/blacha/coginfo/commit/322c4d1))
226
-
227
-
228
-
229
-
230
-
231
- # [2.1.0](https://github.com/blacha/coginfo/compare/v2.0.0...v2.1.0) (2020-06-14)
232
-
233
-
234
- ### Features
235
-
236
- * **cog:** allow file sources to be closed if they need to be ([#430](https://github.com/blacha/coginfo/issues/430)) ([d2441e0](https://github.com/blacha/coginfo/commit/d2441e0))
237
- * **core:** expose epsg information ([54ab940](https://github.com/blacha/coginfo/commit/54ab940))
238
- * **core:** support striped tiffs ([#435](https://github.com/blacha/coginfo/issues/435)) ([8a5d68e](https://github.com/blacha/coginfo/commit/8a5d68e))
239
-
240
-
241
-
242
-
243
-
244
- # [2.0.0](https://github.com/blacha/coginfo/compare/v1.1.0...v2.0.0) (2020-05-18)
245
-
246
-
247
- * feat!: better support for sparse tiffs (#407) ([869073a](https://github.com/blacha/coginfo/commit/869073a)), closes [#407](https://github.com/blacha/coginfo/issues/407)
248
-
249
-
250
- ### BREAKING CHANGES
251
-
252
- * getTile now may return null if there is no data for a tile
253
-
254
- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
255
-
256
-
257
-
258
-
259
-
260
- ## [1.0.8](https://github.com/blacha/coginfo/compare/v1.0.7...v1.0.8) (2020-05-11)
261
-
262
-
263
- ### Bug Fixes
264
-
265
- * **core:** do no read too many bytes from the file ([#388](https://github.com/blacha/coginfo/issues/388)) ([e745249](https://github.com/blacha/coginfo/commit/e745249))
266
-
267
-
268
-
269
-
270
-
271
- ## [1.0.7](https://github.com/blacha/coginfo/compare/v1.0.6...v1.0.7) (2020-05-10)
272
-
273
-
274
- ### Bug Fixes
275
-
276
- * **cli:** dump tiles sometimes failed with "Chunk is not ready" ([#386](https://github.com/blacha/coginfo/issues/386)) ([890ef22](https://github.com/blacha/coginfo/commit/890ef22))
277
-
278
-
279
-
280
-
281
-
282
- ## [1.0.6](https://github.com/blacha/coginfo/compare/v1.0.5...v1.0.6) (2020-05-07)
283
-
284
- **Note:** Version bump only for package @cogeotiff/core
285
-
286
-
287
-
288
-
289
-
290
- ## [1.0.5](https://github.com/blacha/coginfo/compare/v1.0.4...v1.0.5) (2020-05-07)
3
+ ## [8.0.1](https://github.com/blacha/cogeotiff/compare/core-v8.0.0...core-v8.0.1) (2023-08-05)
291
4
 
292
5
 
293
6
  ### Bug Fixes
294
7
 
295
- * allow CogTiff.init() to be called multiple times ([#382](https://github.com/blacha/coginfo/issues/382)) ([f282f9e](https://github.com/blacha/coginfo/commit/f282f9e))
296
-
297
-
298
-
299
-
300
-
301
- ## [1.0.4](https://github.com/blacha/coginfo/compare/v1.0.3...v1.0.4) (2020-04-29)
302
-
303
-
304
- ### Bug Fixes
305
-
306
- * **cli:** zoom has no correlation to any real world zoom ([#373](https://github.com/blacha/coginfo/issues/373)) ([dfccc3e](https://github.com/blacha/coginfo/commit/dfccc3e))
307
-
308
-
309
-
310
-
311
-
312
- ## [1.0.3](https://github.com/blacha/coginfo/compare/v1.0.2...v1.0.3) (2020-03-12)
313
-
314
- **Note:** Version bump only for package @cogeotiff/core
315
-
316
-
317
-
318
-
319
-
320
- ## [1.0.2](https://github.com/blacha/coginfo/compare/v1.0.1...v1.0.2) (2020-03-12)
321
-
322
- **Note:** Version bump only for package @cogeotiff/core
323
-
324
-
325
-
326
-
327
-
328
- ## [1.0.1](https://github.com/blacha/coginfo/compare/v1.0.0...v1.0.1) (2020-03-10)
329
-
330
-
331
- ### Bug Fixes
332
-
333
- * Offset is outside the bounds of the DataView ([3cc8e5b](https://github.com/blacha/coginfo/commit/3cc8e5b))
334
-
335
-
336
-
337
-
338
-
339
- # [1.0.0](https://github.com/blacha/coginfo/compare/v0.9.1...v1.0.0) (2020-03-09)
340
-
341
-
342
- * feat!: load geotags from other tiff tags ([a34f323](https://github.com/blacha/coginfo/commit/a34f323))
343
-
344
-
345
- ### Features
346
-
347
- * show more information about tiff tags when requested ([d13ea48](https://github.com/blacha/coginfo/commit/d13ea48))
348
-
349
-
350
- ### BREAKING CHANGES
351
-
352
- * this forces a async load to be called before geo tags can be accessed
353
-
354
-
355
-
356
-
357
-
358
- # [0.9.0](https://github.com/blacha/coginfo/compare/v0.8.0...v0.9.0) (2020-01-16)
359
-
360
-
361
- ### Bug Fixes
362
-
363
- * correctly reject excpetions thrown inside of a fetch ([ab8fe9a](https://github.com/blacha/coginfo/commit/ab8fe9a))
364
-
365
-
366
- ### Features
367
-
368
- * allow the cli to load geotiffs from s3 ([8db14c9](https://github.com/blacha/coginfo/commit/8db14c9))
369
-
370
-
371
-
372
-
373
-
374
- # [0.8.0](https://github.com/blacha/coginfo/compare/v0.7.0...v0.8.0) (2020-01-16)
375
-
376
- **Note:** Version bump only for package @cogeotiff/core
377
-
378
-
379
-
380
-
381
-
382
- # [0.7.0](https://github.com/blacha/coginfo/compare/v0.6.0...v0.7.0) (2019-12-08)
383
-
384
- **Note:** Version bump only for package @cogeotiff/core
385
-
386
-
387
-
388
-
389
-
390
- # [0.6.0](https://github.com/blacha/coginfo/compare/v0.5.0...v0.6.0) (2019-11-22)
391
-
392
-
393
- ### Features
394
-
395
- * parse geokeys to get projections ([2b2dcf6](https://github.com/blacha/coginfo/commit/2b2dcf6))
396
-
397
-
398
-
399
-
400
-
401
- # [0.5.0](https://github.com/blacha/coginfo/compare/v0.4.1...v0.5.0) (2019-11-21)
402
-
403
-
404
- ### Bug Fixes
405
-
406
- * force read in a few kb of data around the headers ([bf7a63a](https://github.com/blacha/coginfo/commit/bf7a63a))
407
-
408
-
409
- ### Features
410
-
411
- * typescript 3.7 ([ada8c2b](https://github.com/blacha/coginfo/commit/ada8c2b))
412
-
413
-
414
-
415
-
416
-
417
- ## [0.4.1](https://github.com/blacha/coginfo/compare/v0.4.0...v0.4.1) (2019-10-08)
418
-
419
- **Note:** Version bump only for package @cogeotiff/core
420
-
421
-
422
-
423
-
424
-
425
- # [0.4.0](https://github.com/blacha/coginfo/compare/v0.3.1...v0.4.0) (2019-10-08)
426
-
427
-
428
- ### Bug Fixes
429
-
430
- * eslint complains about log?.trace() syntax ([337224c](https://github.com/blacha/coginfo/commit/337224c))
431
- * lgtm issues ([5ccde83](https://github.com/blacha/coginfo/commit/5ccde83))
432
-
433
-
434
- ### Features
435
-
436
- * expose img.getTileBounds ([9bfd1c1](https://github.com/blacha/coginfo/commit/9bfd1c1))
437
- * lazy load more data to reduce initial read time for ifd ([74e1dc7](https://github.com/blacha/coginfo/commit/74e1dc7))
438
- * optimize reads if they are contained within one chunk ([824a629](https://github.com/blacha/coginfo/commit/824a629))
439
- * switch to typescript 3.7 to remove some costly logging ([a585195](https://github.com/blacha/coginfo/commit/a585195))
440
-
441
-
442
-
443
-
444
-
445
- ## [0.3.1](https://github.com/blacha/coginfo/compare/v0.3.0...v0.3.1) (2019-09-25)
446
-
447
- **Note:** Version bump only for package @cogeotiff/core
448
-
449
-
450
-
451
-
452
-
453
- # [0.3.0](https://github.com/blacha/coginfo/compare/v0.2.3...v0.3.0) (2019-09-24)
454
-
455
-
456
- ### Bug Fixes
457
-
458
- * guard always evaluates false ([dd9550b](https://github.com/blacha/coginfo/commit/dd9550b))
459
-
460
-
461
- ### Features
462
-
463
- * adding support for getting by resolution ([69d3a5d](https://github.com/blacha/coginfo/commit/69d3a5d))
464
- * include image size of a tile ([31aa174](https://github.com/blacha/coginfo/commit/31aa174))
465
-
466
-
467
-
468
-
469
-
470
- ## [0.2.2](https://github.com/blacha/coginfo/compare/v0.2.1...v0.2.2) (2019-09-12)
471
-
472
-
473
- ### Bug Fixes
474
-
475
- * ignore tsconfig.tsbuildinfo when publishing ([8a27600](https://github.com/blacha/coginfo/commit/8a27600))
476
-
477
-
478
-
479
-
480
-
481
- ## [0.2.1](https://github.com/blacha/coginfo/compare/v0.2.0...v0.2.1) (2019-09-12)
482
-
483
-
484
- ### Bug Fixes
485
-
486
- * cannot publish without access:public ([a408389](https://github.com/blacha/coginfo/commit/a408389))
487
-
488
-
489
-
490
-
491
-
492
- # [0.2.0](https://github.com/blacha/coginfo/compare/v0.0.12...v0.2.0) (2019-09-12)
493
-
494
-
495
- ### Bug Fixes
496
-
497
- * load required ifd tags when the image loads if they are not part of the same block as the ifd ([a6713cc](https://github.com/blacha/coginfo/commit/a6713cc))
498
- * remove cyclic dependency ([d0ab5f5](https://github.com/blacha/coginfo/commit/d0ab5f5))
499
-
500
-
501
- ### Features
502
-
503
- * rename to cogeotiff ([9a2c099](https://github.com/blacha/coginfo/commit/9a2c099))
504
- * support lzw & deflate output ([dd0f6aa](https://github.com/blacha/coginfo/commit/dd0f6aa))
505
- * support model transformation ([9af4034](https://github.com/blacha/coginfo/commit/9af4034))
8
+ * broken changelog ordering ([31f8c8a](https://github.com/blacha/cogeotiff/commit/31f8c8ac5e2770427ed2dc0f5c7c34330c6cb0eb))
package/README.md CHANGED
@@ -1,28 +1,46 @@
1
1
  # @cogeotiff/core
2
2
 
3
- Reading logic for GeoTiffs
3
+ Working with [Cloud optimized GEOTiff](https://www.cogeo.org/)
4
+
5
+ - Completely javascript based, works in the browser and nodejs
6
+ - Lazy load COG images and metadata
7
+ - Supports huge 100GB+ COGs
8
+ - Uses GDAL COG optimizations, generally only one or two reads per tile!
9
+ - Loads COGs from URL, File, Google Cloud or AWS S3
10
+ - Used in production for [LINZ's Basemaps](https://github.com/linz/basemaps) with billions of tiles fetched from COGs!
4
11
 
5
12
  ## Usage
6
13
 
14
+ Load a COG from a remote http source
15
+
7
16
  ```typescript
8
- import { CogSourceUrl } from '@chunkd/source-url';
17
+ import { SourceHttp } from '@chunkd/source-url';
18
+ import { CogTiff } from '@cogeotiff/core'
9
19
 
10
- const source = new CogSourceUrl('https://example.com/cog.tif');
11
- const tiff = await CogTiff.create(source)
20
+ const source = new SourceHttp('https://example.com/cog.tif');
21
+ const tiff = await CogTiff.create(source);
12
22
 
13
23
  /** Load a specific tile from a specific image */
14
- const tile = await cog.getTile(2, 2, 5);
24
+ const tile = await tiff.images[5].getTile(2, 2);
15
25
 
16
- /** Load the 5th image in the Tif */
17
- const img = cog.getImage(5);
26
+ /** Load the 5th image in the Tiff */
27
+ const img = tiff.images[5];
18
28
  if (img.isTiled()) {
19
29
  /** Load tile x:10 y:10 */
20
30
  const tile = await img.getTile(10, 10);
21
-
22
- const tileInfo = img.tileInfo
31
+ tile.mimeType; // image/jpeg
32
+ tile.bytes; // Raw image buffer
23
33
  }
24
34
 
25
- /** Get the origin point of the tif */
35
+ /** Get the origin point of the tiff */
26
36
  const origin = img.origin;
37
+ /** Bounding box of the tiff */
27
38
  const bbox = img.bbox;
28
39
  ```
40
+
41
+
42
+ More examples can bee seen
43
+
44
+ - [@cogeotiff/example](https://github.com/blacha/cogeotiff/tree/master/packages/examples)
45
+ - [CogViewer](https://github.com/blacha/cogeotiff-web)
46
+ - [@chunkd](https://github.com/blacha/chunkd) Additional sources eg file:// and s3://
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=cog.read.benchmark.d.ts.map
@@ -1,18 +1,20 @@
1
- import { SourceMemory } from '@chunkd/core';
2
1
  import { readFile } from 'fs/promises';
3
2
  import { CogTiff } from '../cog.tiff.js';
3
+ import { SourceMemory } from './source.memory.js';
4
+ // console.log = console.trace;
4
5
  /** Read a tile from every image inside of a tiff 300 tiles read */
5
6
  async function main() {
6
7
  const buf = await readFile(process.argv[process.argv.length - 1]);
7
- const source = new SourceMemory('buf', buf);
8
+ const source = new SourceMemory(buf);
8
9
  for (let i = 0; i < 5000; i++) {
10
+ performance.mark('cog:init');
9
11
  const tiff = new CogTiff(source);
10
12
  await tiff.init();
13
+ performance.mark('cog:init:done');
11
14
  // 6 images
12
15
  for (const img of tiff.images)
13
16
  await img.getTile(0, 0);
14
- await tiff.close();
15
17
  }
16
18
  }
17
19
  main();
18
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29nLnJlYWQuYmVuY2htYXJrLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL19fYmVuY2htYXJrX18vY29nLnJlYWQuYmVuY2htYXJrLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSxjQUFjLENBQUM7QUFDNUMsT0FBTyxFQUFFLFFBQVEsRUFBRSxNQUFNLGFBQWEsQ0FBQztBQUN2QyxPQUFPLEVBQUUsT0FBTyxFQUFFLE1BQU0sZ0JBQWdCLENBQUM7QUFFekMsbUVBQW1FO0FBQ25FLEtBQUssVUFBVSxJQUFJO0lBQ2YsTUFBTSxHQUFHLEdBQUcsTUFBTSxRQUFRLENBQUMsT0FBTyxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUMsSUFBSSxDQUFDLE1BQU0sR0FBRyxDQUFDLENBQUMsQ0FBQyxDQUFDO0lBQ2xFLE1BQU0sTUFBTSxHQUFHLElBQUksWUFBWSxDQUFDLEtBQUssRUFBRSxHQUFHLENBQUMsQ0FBQztJQUM1QyxLQUFLLElBQUksQ0FBQyxHQUFHLENBQUMsRUFBRSxDQUFDLEdBQUcsSUFBSyxFQUFFLENBQUMsRUFBRSxFQUFFO1FBQzVCLE1BQU0sSUFBSSxHQUFHLElBQUksT0FBTyxDQUFDLE1BQU0sQ0FBQyxDQUFDO1FBQ2pDLE1BQU0sSUFBSSxDQUFDLElBQUksRUFBRSxDQUFDO1FBRWxCLFdBQVc7UUFDWCxLQUFLLE1BQU0sR0FBRyxJQUFJLElBQUksQ0FBQyxNQUFNO1lBQUUsTUFBTSxHQUFHLENBQUMsT0FBTyxDQUFDLENBQUMsRUFBRSxDQUFDLENBQUMsQ0FBQztRQUN2RCxNQUFNLElBQUksQ0FBQyxLQUFLLEVBQUUsQ0FBQztLQUN0QjtBQUNMLENBQUM7QUFFRCxJQUFJLEVBQUUsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IFNvdXJjZU1lbW9yeSB9IGZyb20gJ0BjaHVua2QvY29yZSc7XG5pbXBvcnQgeyByZWFkRmlsZSB9IGZyb20gJ2ZzL3Byb21pc2VzJztcbmltcG9ydCB7IENvZ1RpZmYgfSBmcm9tICcuLi9jb2cudGlmZi5qcyc7XG5cbi8qKiBSZWFkIGEgdGlsZSBmcm9tIGV2ZXJ5IGltYWdlIGluc2lkZSBvZiBhIHRpZmYgMzAwIHRpbGVzIHJlYWQgKi9cbmFzeW5jIGZ1bmN0aW9uIG1haW4oKTogUHJvbWlzZTx2b2lkPiB7XG4gICAgY29uc3QgYnVmID0gYXdhaXQgcmVhZEZpbGUocHJvY2Vzcy5hcmd2W3Byb2Nlc3MuYXJndi5sZW5ndGggLSAxXSk7XG4gICAgY29uc3Qgc291cmNlID0gbmV3IFNvdXJjZU1lbW9yeSgnYnVmJywgYnVmKTtcbiAgICBmb3IgKGxldCBpID0gMDsgaSA8IDVfMDAwOyBpKyspIHtcbiAgICAgICAgY29uc3QgdGlmZiA9IG5ldyBDb2dUaWZmKHNvdXJjZSk7XG4gICAgICAgIGF3YWl0IHRpZmYuaW5pdCgpO1xuXG4gICAgICAgIC8vIDYgaW1hZ2VzXG4gICAgICAgIGZvciAoY29uc3QgaW1nIG9mIHRpZmYuaW1hZ2VzKSBhd2FpdCBpbWcuZ2V0VGlsZSgwLCAwKTtcbiAgICAgICAgYXdhaXQgdGlmZi5jbG9zZSgpO1xuICAgIH1cbn1cblxubWFpbigpO1xuIl19
20
+ //# sourceMappingURL=cog.read.benchmark.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cog.read.benchmark.js","sourceRoot":"","sources":["../../src/__benchmark__/cog.read.benchmark.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,+BAA+B;AAC/B,mEAAmE;AACnE,KAAK,UAAU,IAAI;IACjB,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;IAClE,MAAM,MAAM,GAAG,IAAI,YAAY,CAAC,GAAG,CAAC,CAAC;IACrC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAK,EAAE,CAAC,EAAE,EAAE;QAC9B,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC7B,MAAM,IAAI,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;QACjC,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;QAClB,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QAElC,WAAW;QACX,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,MAAM;YAAE,MAAM,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;KACxD;AACH,CAAC;AAED,IAAI,EAAE,CAAC"}
@@ -0,0 +1,9 @@
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ import { Source } from '../source.js';
3
+ export declare class TestFileSource implements Source {
4
+ url: URL;
5
+ data: Promise<Buffer>;
6
+ constructor(fileName: URL);
7
+ fetch(offset: number, length: number): Promise<ArrayBuffer>;
8
+ get size(): Promise<number>;
9
+ }
@@ -0,0 +1,29 @@
1
+ import { readFile, stat } from 'fs/promises';
2
+ export class TestFileSource {
3
+ constructor(fileName) {
4
+ Object.defineProperty(this, "url", {
5
+ enumerable: true,
6
+ configurable: true,
7
+ writable: true,
8
+ value: void 0
9
+ });
10
+ Object.defineProperty(this, "data", {
11
+ enumerable: true,
12
+ configurable: true,
13
+ writable: true,
14
+ value: void 0
15
+ });
16
+ this.url = fileName;
17
+ this.data = readFile(this.url);
18
+ }
19
+ async fetch(offset, length) {
20
+ const fileData = await this.data;
21
+ return fileData.buffer.slice(fileData.byteOffset + offset, fileData.byteOffset + offset + length);
22
+ }
23
+ get size() {
24
+ return Promise.resolve()
25
+ .then(() => stat(this.url))
26
+ .then((f) => f.size);
27
+ }
28
+ }
29
+ //# sourceMappingURL=source.file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source.file.js","sourceRoot":"","sources":["../../src/__benchmark__/source.file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAG7C,MAAM,OAAO,cAAc;IAIzB,YAAY,QAAa;QAHzB;;;;;WAAS;QACT;;;;;WAAsB;QAGpB,IAAI,CAAC,GAAG,GAAG,QAAQ,CAAC;QACpB,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACjC,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,MAAc,EAAE,MAAc;QACxC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC;QACjC,OAAO,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,GAAG,MAAM,EAAE,QAAQ,CAAC,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC,CAAC;IACpG,CAAC;IAED,IAAI,IAAI;QACN,OAAO,OAAO,CAAC,OAAO,EAAE;aACrB,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;aAC1B,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;CACF"}
@@ -0,0 +1,9 @@
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ import { Source } from '../source.js';
3
+ export declare class SourceMemory implements Source {
4
+ url: URL;
5
+ data: ArrayBuffer;
6
+ static toArrayBuffer(buf: Buffer | Uint8Array | ArrayBuffer): ArrayBuffer;
7
+ constructor(bytes: Buffer | Uint8Array | ArrayBuffer);
8
+ fetch(offset: number, length?: number): Promise<ArrayBuffer>;
9
+ }
@@ -0,0 +1,32 @@
1
+ export class SourceMemory {
2
+ static toArrayBuffer(buf) {
3
+ if (buf instanceof ArrayBuffer)
4
+ return buf;
5
+ if (buf.byteLength === buf.buffer.byteLength)
6
+ return buf.buffer;
7
+ return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
8
+ }
9
+ constructor(bytes) {
10
+ Object.defineProperty(this, "url", {
11
+ enumerable: true,
12
+ configurable: true,
13
+ writable: true,
14
+ value: void 0
15
+ });
16
+ Object.defineProperty(this, "data", {
17
+ enumerable: true,
18
+ configurable: true,
19
+ writable: true,
20
+ value: void 0
21
+ });
22
+ this.url = new URL('memory://fake-file');
23
+ this.data = SourceMemory.toArrayBuffer(bytes);
24
+ }
25
+ async fetch(offset, length) {
26
+ // console.log('Fetch', offset, length);
27
+ if (offset < 0)
28
+ offset = this.data.byteLength + offset;
29
+ return this.data.slice(offset, length == null ? undefined : offset + length);
30
+ }
31
+ }
32
+ //# sourceMappingURL=source.memory.js.map