@mapcatch/util 1.0.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 (71) hide show
  1. package/.eslintrc.js +53 -0
  2. package/.prettierrc +4 -0
  3. package/CHANGELOG.md +0 -0
  4. package/README.md +44 -0
  5. package/docs/Catolog.md +24 -0
  6. package/docs/Util.md +170 -0
  7. package/package.json +30 -0
  8. package/src/constants/cameras.js +5 -0
  9. package/src/constants/index.js +1 -0
  10. package/src/event.js +205 -0
  11. package/src/exif/exif.js +37 -0
  12. package/src/exif/gps_tags.js +33 -0
  13. package/src/exif/ifd1_tags.js +22 -0
  14. package/src/exif/index.js +16 -0
  15. package/src/exif/iptc_field_map.js +12 -0
  16. package/src/exif/parse_image.js +446 -0
  17. package/src/exif/string_values.js +137 -0
  18. package/src/exif/tags.js +75 -0
  19. package/src/exif/tiff_tags.js +35 -0
  20. package/src/exif/util.js +108 -0
  21. package/src/gl-operations/constants.js +11 -0
  22. package/src/gl-operations/default_options.js +98 -0
  23. package/src/gl-operations/index.js +594 -0
  24. package/src/gl-operations/reglCommands/contours.js +27 -0
  25. package/src/gl-operations/reglCommands/default.js +44 -0
  26. package/src/gl-operations/reglCommands/hillshading.js +332 -0
  27. package/src/gl-operations/reglCommands/index.js +6 -0
  28. package/src/gl-operations/reglCommands/multiLayers.js +301 -0
  29. package/src/gl-operations/reglCommands/transitions.js +109 -0
  30. package/src/gl-operations/reglCommands/util.js +71 -0
  31. package/src/gl-operations/renderer.js +193 -0
  32. package/src/gl-operations/shaders/fragment/convertDem.js +26 -0
  33. package/src/gl-operations/shaders/fragment/convolutionSmooth.js +55 -0
  34. package/src/gl-operations/shaders/fragment/diffCalc.js +34 -0
  35. package/src/gl-operations/shaders/fragment/drawResult.js +42 -0
  36. package/src/gl-operations/shaders/fragment/hillshading/hsAdvAmbientShadows.js +79 -0
  37. package/src/gl-operations/shaders/fragment/hillshading/hsAdvDirect.js +55 -0
  38. package/src/gl-operations/shaders/fragment/hillshading/hsAdvFinalBaselayer.js +31 -0
  39. package/src/gl-operations/shaders/fragment/hillshading/hsAdvFinalColorscale.js +56 -0
  40. package/src/gl-operations/shaders/fragment/hillshading/hsAdvMergeAndScaleTiles.js +27 -0
  41. package/src/gl-operations/shaders/fragment/hillshading/hsAdvNormals.js +26 -0
  42. package/src/gl-operations/shaders/fragment/hillshading/hsAdvSmooth.js +54 -0
  43. package/src/gl-operations/shaders/fragment/hillshading/hsAdvSoftShadows.js +81 -0
  44. package/src/gl-operations/shaders/fragment/hillshading/hsPregen.js +50 -0
  45. package/src/gl-operations/shaders/fragment/interpolateColor.js +63 -0
  46. package/src/gl-operations/shaders/fragment/interpolateColorOnly.js +47 -0
  47. package/src/gl-operations/shaders/fragment/interpolateValue.js +124 -0
  48. package/src/gl-operations/shaders/fragment/multiAnalyze1Calc.js +36 -0
  49. package/src/gl-operations/shaders/fragment/multiAnalyze2Calc.js +46 -0
  50. package/src/gl-operations/shaders/fragment/multiAnalyze3Calc.js +54 -0
  51. package/src/gl-operations/shaders/fragment/multiAnalyze4Calc.js +62 -0
  52. package/src/gl-operations/shaders/fragment/multiAnalyze5Calc.js +70 -0
  53. package/src/gl-operations/shaders/fragment/multiAnalyze6Calc.js +78 -0
  54. package/src/gl-operations/shaders/fragment/single.js +88 -0
  55. package/src/gl-operations/shaders/transform.js +22 -0
  56. package/src/gl-operations/shaders/util/computeColor.glsl +84 -0
  57. package/src/gl-operations/shaders/util/getTexelValue.glsl +10 -0
  58. package/src/gl-operations/shaders/util/isCloseEnough.glsl +9 -0
  59. package/src/gl-operations/shaders/util/rgbaToFloat.glsl +18 -0
  60. package/src/gl-operations/shaders/vertex/double.js +17 -0
  61. package/src/gl-operations/shaders/vertex/multi3.js +20 -0
  62. package/src/gl-operations/shaders/vertex/multi4.js +23 -0
  63. package/src/gl-operations/shaders/vertex/multi5.js +26 -0
  64. package/src/gl-operations/shaders/vertex/multi6.js +29 -0
  65. package/src/gl-operations/shaders/vertex/single.js +13 -0
  66. package/src/gl-operations/shaders/vertex/singleNotTransformed.js +12 -0
  67. package/src/gl-operations/texture_manager.js +141 -0
  68. package/src/gl-operations/util.js +336 -0
  69. package/src/index.js +10 -0
  70. package/src/util.js +332 -0
  71. package/vite.config.js +52 -0
package/.eslintrc.js ADDED
@@ -0,0 +1,53 @@
1
+ module.exports = {
2
+ root: true,
3
+ env: {
4
+ node: true,
5
+ browser: true,
6
+ },
7
+ extends: ['eslint:recommended'],
8
+ parser: 'babel-eslint',
9
+ rules: {
10
+ 'no-extra-semi': 'error',
11
+ 'no-console': ['error', { allow: ['warn', 'error'] }],
12
+ quotes: [
13
+ 'error',
14
+ 'single',
15
+ {
16
+ avoidEscape: true,
17
+ allowTemplateLiterals: true,
18
+ },
19
+ ],
20
+ semi: ['error', 'never'],
21
+ indent: [
22
+ 'error',
23
+ 2,
24
+ {
25
+ SwitchCase: 1,
26
+ flatTernaryExpressions: true,
27
+ },
28
+ ],
29
+ 'comma-dangle': ['error', 'never'],
30
+ 'no-multi-spaces': [
31
+ 'error',
32
+ {
33
+ ignoreEOLComments: true,
34
+ },
35
+ ],
36
+ 'space-infix-ops': 'error',
37
+ 'space-unary-ops': [
38
+ 'error',
39
+ {
40
+ words: true,
41
+ nonwords: false,
42
+ },
43
+ ],
44
+ 'space-before-function-paren': 'error',
45
+ },
46
+ globals: {
47
+ echarts: true,
48
+ },
49
+ parserOptions: {
50
+ ecmaVersion: 7,
51
+ sourceType: 'module',
52
+ },
53
+ }
package/.prettierrc ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "singleQuote": true,
3
+ "semi": false
4
+ }
package/CHANGELOG.md ADDED
File without changes
package/README.md ADDED
@@ -0,0 +1,44 @@
1
+ # catchUtil
2
+ Mapcatch系列产品的公共函数、js工具以及相关的配置信息。
3
+
4
+ ## 使用方法
5
+
6
+ ### cdn引入
7
+ ```html
8
+ <script src="//unpkg.com/@mapcatch/util@latest/dist/catchUtil.min.js"></script>
9
+
10
+ <script>
11
+ // 解析jpg中的exif信息
12
+ catchUtil.getPhotoTags(file).then(info => {
13
+ console.log(info)
14
+ })
15
+ // 生成随机Id
16
+ catchUtil.generateId()
17
+ </script>
18
+
19
+ ```
20
+
21
+ ### 通过npm安装
22
+ ```
23
+ npm install @mapcatch/util
24
+ ```
25
+
26
+ ```js
27
+ import {getPhotoTags, generateId} from '@mapcatch/util'
28
+
29
+ // 解析jpg中的exif信息
30
+ getPhotoTags(file).then(info => {
31
+ console.log(info)
32
+ })
33
+ // 生成随机Id
34
+ generateId()
35
+ ```
36
+ ## 文档
37
+ 更多文档查看[在线文档](./docs/Catolog.md)
38
+
39
+ ## 开发
40
+ ```bash
41
+ yarn
42
+
43
+ yarn build
44
+ ```
@@ -0,0 +1,24 @@
1
+ ## 目录
2
+
3
+ catchUtil主要包括四个部分:
4
+
5
+ - [工具函数](./Util.md)
6
+
7
+ - [事件管理类](./Event.md)
8
+
9
+ - [栅格瓦片自定义样式重渲染](./GlOptions.md)
10
+
11
+ - [常量和配置项](./Constant.md)
12
+
13
+ ### 基本用法
14
+
15
+ ```js
16
+ import {getPhotoTags, generateId} from '@mapcatch/util'
17
+
18
+ // 解析jpg中的exif信息
19
+ getPhotoTags(file).then(info => {
20
+ console.log(info)
21
+ })
22
+ // 生成随机Id
23
+ generateId()
24
+ ```
package/docs/Util.md ADDED
@@ -0,0 +1,170 @@
1
+ ## 工具函数
2
+
3
+ 基本用法:
4
+
5
+ ```js
6
+ // 完整引入
7
+ import * as catchUtil from '@mapcatch/util'
8
+ // 或者按需引入
9
+ import {getPhotoTags} from '@mapcatch/util'
10
+ ```
11
+
12
+ ### `getPhotoTags(file)`
13
+
14
+ 获取照片文件中的exif信息,例如GPS位置、拍摄的设备型号等。为加快解析速度,可以只截取图片的前64kB进行解析,而不用传整个文件进来解析。
15
+
16
+ **参数**
17
+
18
+ *file* `File` 需要解析的文件,必须是HTML5的File对象
19
+
20
+ **返回值**
21
+
22
+ `Promise`: 一个Promise对象,用来获取解析结果
23
+
24
+ **示例**
25
+
26
+ ```js
27
+ getPhotoTags(file).then(info => {
28
+ console.log(info)
29
+ }).catch(err => {
30
+ throw err
31
+ })
32
+ ```
33
+
34
+ ### `generateId()`
35
+
36
+ 生成一个随机id字符串
37
+
38
+ **返回值**
39
+
40
+ `uuid`: 使用uuidv4生成一个随机id
41
+
42
+ ### `formatDate(date)`
43
+
44
+ 将数据库的日期字符串格式化用来前端显示。
45
+
46
+ **参数**
47
+
48
+ *date* `Date String` 日期字符串
49
+
50
+ **返回值**
51
+
52
+ `String` 格式化以后的日期,如`2023-08-01 12:56:32`
53
+
54
+ ### `formatLocalDate()`
55
+
56
+ 将当前的本地时间转为字符串,这个函数主要是为了解决`.toLocaleDateString()`在不同浏览器结果可能不一致的问题。
57
+
58
+ **返回值**
59
+
60
+ `String` 格式化以后的日期,如`2023/8/1 12:56:32`
61
+
62
+ ### `formatFileSize(size)`
63
+
64
+ 将以字节为单位的文件大小自动转为`KB`、`MB`等用来显示。
65
+
66
+ **参数**
67
+
68
+ *size* `Number` 文件大小
69
+
70
+ **返回值**
71
+
72
+ `String` 格式化以后文件大小,例如`342KB`
73
+
74
+ ### `getPhotoInfo(file)`
75
+
76
+ 获取照片文件的拍摄日期、相机型号和GPS位置信息,与`getPhotoTags(file)`不同,该函数只获取这三个属性,并会将位置信息格式化为十进制度。
77
+
78
+ **参数**
79
+
80
+ *file* `File` 需要解析的文件,必须是HTML5的File对象
81
+
82
+ **返回值**
83
+
84
+ `Promise`: 一个Promise对象,用来获取解析结果
85
+
86
+ **示例**
87
+
88
+ ```js
89
+ let info = await getPhotoInfo(file)
90
+
91
+ /*
92
+ {
93
+ date: '2020-04-21',
94
+ Model: 'FC6310R',
95
+ position: {
96
+ lng: 110.3456,
97
+ lat: 32.56434526,
98
+ alt: 78.432
99
+ }
100
+ }
101
+ */
102
+ ```
103
+
104
+ ### `getPhotoMeta(file)`
105
+
106
+ 获取照片文件的元数据信息,包括md5和原始exif信息。
107
+
108
+ > 注意,为了提高解析性能,该接口只计算文件前64KB的md5,用于确保文件的唯一性,但无法保证文件的完整性。
109
+
110
+ **参数**
111
+
112
+ *file* `File` 需要解析的文件,必须是HTML5的File对象
113
+
114
+ **返回值**
115
+
116
+ `Promise`: 一个Promise对象,用来获取解析结果
117
+
118
+ **示例**
119
+
120
+ ```js
121
+ let info = await getPhotoMeta(file)
122
+
123
+ /*
124
+ {
125
+ md5: '.....',
126
+ exif: {...}
127
+ }
128
+ */
129
+ ```
130
+
131
+ ### `getGeoCoordOperator(flag)`
132
+
133
+ 一般照片GPS位置中的经纬度用`N`和`E`来表示北纬和东经,但我们程序中通常用带有正负号的十进制度表示,此接口用来根据这些标识来获取正负号。
134
+
135
+ **参数**
136
+
137
+ *flag* `String` 经纬度的标识字符
138
+
139
+ **返回值**
140
+
141
+ `number`: 1或者-1
142
+
143
+ **示例**
144
+
145
+ ```js
146
+ getGeoCoordOperator('N')
147
+ // 1
148
+ getGeoCoordOperator('S')
149
+ // -1
150
+ ```
151
+
152
+ ### `toRadian(arr)`
153
+
154
+ 将数组表示的度分秒转为带小数的度。
155
+
156
+ **参数**
157
+
158
+ *arr* `Array` 度分秒数组
159
+
160
+ **返回值**
161
+
162
+ `number`: 十进制度
163
+
164
+ **示例**
165
+
166
+ ```js
167
+ let arr = [110, 30, 20]
168
+ toRadian(arr)
169
+ // 110.5055555555
170
+ ```
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "@mapcatch/util",
3
+ "version": "1.0.0",
4
+ "main": "./src/index.js",
5
+ "repository": "",
6
+ "author": "wanyanyan",
7
+ "license": "MIT",
8
+ "scripts": {
9
+ "build": "vite build",
10
+ "start": "vite --host",
11
+ "lint": "eslint src/ --fix",
12
+ "format": "prettier-eslint --write src/*.js"
13
+ },
14
+ "dependencies": {
15
+ "@turf/turf": "^6.5.0",
16
+ "gl-matrix": "^3.4.3",
17
+ "glsl-float-to-rgba": "^1.0.0",
18
+ "glsl-rgba-to-float": "^1.0.0",
19
+ "lodash": "^4.17.21",
20
+ "moment": "^2.29.4",
21
+ "regl": "^2.1.0",
22
+ "spark-md5": "^3.0.2",
23
+ "upng-js": "^2.1.0",
24
+ "uuid": "^9.0.0"
25
+ },
26
+ "devDependencies": {
27
+ "vite": "^3.0.9",
28
+ "vite-plugin-glslify": "^2.0.2"
29
+ }
30
+ }
@@ -0,0 +1,5 @@
1
+ export default {
2
+ normal: ['FC6310R', 'FC6310'],
3
+ infrared: ['M3T'],
4
+ multispectral: ['FC6360']
5
+ }
@@ -0,0 +1 @@
1
+ export {default as cameras} from './cameras'
package/src/event.js ADDED
@@ -0,0 +1,205 @@
1
+ // @flow
2
+
3
+
4
+ let clickPoint = null
5
+
6
+ function _addEventListener (type, listener, listenerList) {
7
+ listenerList[type] = listenerList[type] || []
8
+ listenerList[type].push(listener)
9
+ }
10
+
11
+ function _removeEventListener (type, listener, listenerList) {
12
+ if (listenerList && listenerList[type]) {
13
+ const index = listenerList[type].indexOf(listener)
14
+ if (index !== -1) {
15
+ listenerList[type].splice(index, 1)
16
+ }
17
+ }
18
+ }
19
+
20
+ function extend (dest, ...sources) {
21
+ for (const src of sources) {
22
+ for (const k in src) {
23
+ dest[k] = src[k]
24
+ }
25
+ }
26
+ return dest
27
+ }
28
+ function endsWith (string, suffix) {
29
+ return string.indexOf(suffix, string.length - suffix.length) !== -1
30
+ }
31
+
32
+ /**
33
+ * Methods mixed in to other classes for event capabilities.
34
+ *
35
+ * @mixin Evented
36
+ */
37
+ class Event {
38
+ constructor () {
39
+ this._listeners = []
40
+ this._oneTimeListeners = []
41
+ this._eventedParent = null
42
+ this._eventedParentData = null
43
+ }
44
+
45
+ /**
46
+ * Adds a listener to a specified event type.
47
+ *
48
+ * @param {string} type The event type to add a listen for.
49
+ * @param {Function} listener The function to be called when the event is fired.
50
+ * The listener function is called with the data object passed to `fire`,
51
+ * extended with `target` and `type` properties.
52
+ * @returns {Object} `this`
53
+ */
54
+ on (type, listener) {
55
+ this._listeners = this._listeners || {}
56
+ //将this._listeners 添加listener事件
57
+ _addEventListener(type, listener, this._listeners)
58
+ //返回的this 就是实例Vmap
59
+ return this
60
+ }
61
+
62
+ /**
63
+ * Removes a previously registered event listener.
64
+ *
65
+ * @param {string} type The event type to remove listeners for.
66
+ * @param {Function} listener The listener function to remove.
67
+ * @returns {Object} `this`
68
+ */
69
+ off (type, listener) {
70
+ if (!listener) {
71
+ this._listeners = {}
72
+ this._oneTimeListeners = {}
73
+ return
74
+ }
75
+ _removeEventListener(type, listener, this._listeners)
76
+ _removeEventListener(type, listener, this._oneTimeListeners)
77
+
78
+ return this
79
+ }
80
+
81
+ /**
82
+ * Adds a listener that will be called only once to a specified event type.
83
+ *
84
+ * The listener will be called first time the event fires after the listener is registered.
85
+ *
86
+ * @param {string} type The event type to listen for.
87
+ * @param {Function} listener The function to be called when the event is fired the first time.
88
+ * @returns {Object} `this`
89
+ */
90
+ once (type, listener) {
91
+ this._oneTimeListeners = this._oneTimeListeners || {}
92
+ _addEventListener(type, listener, this._oneTimeListeners)
93
+
94
+ return this
95
+ }
96
+
97
+ /**
98
+ * Fires an event of the specified type.
99
+ *
100
+ * @param {string} type The type of event to fire.
101
+ * @param {Object} [data] Data to be passed to any listeners.
102
+ * @returns {Object} `this`
103
+ */
104
+ fire (type, data) {
105
+ if (this.listens(type)) {
106
+ data = extend({}, data, { type: type, target: this })
107
+ //通过判断点击的点位置是否相同来进行e的输出
108
+ if (clickPoint) {
109
+ if(data.point && (clickPoint === (data.point.x + data.point.y))) {
110
+ if (clickPoint === (data.point.x + data.point.y)){
111
+ return
112
+ } else {
113
+ clickPoint = data.point.x + data.point.y
114
+ }
115
+ } else if (data.feature) {
116
+ if (clickPoint === (data.x + data.y)){
117
+ return
118
+ } else {
119
+ clickPoint = data.x + data.y
120
+ }
121
+ }
122
+ } else {
123
+ if(data.point) {
124
+ clickPoint = data.point.x + data.point.y
125
+ } else if (data.feature) {
126
+ clickPoint = data.x + data.y
127
+ }
128
+ }
129
+
130
+ // make sure adding or removing listeners inside other listeners won't cause an infinite loop
131
+ const listeners =
132
+ this._listeners && this._listeners[type]
133
+ ? this._listeners[type].slice()
134
+ : []
135
+
136
+ for (let i = 0; i < listeners.length; i++) {
137
+ listeners[i].call(this, data)
138
+ }
139
+
140
+ const oneTimeListeners =
141
+ this._oneTimeListeners && this._oneTimeListeners[type]
142
+ ? this._oneTimeListeners[type].slice()
143
+ : []
144
+
145
+ for (let i = 0; i < oneTimeListeners.length; i++) {
146
+ oneTimeListeners[i].call(this, data)
147
+ _removeEventListener(type, oneTimeListeners[i], this._oneTimeListeners)
148
+ }
149
+
150
+ if (this._eventedParent) {
151
+ this._eventedParent.fire(
152
+ type,
153
+ extend(
154
+ {},
155
+ data,
156
+ typeof this._eventedParentData === 'function'
157
+ ? this._eventedParentData()
158
+ : this._eventedParentData
159
+ )
160
+ )
161
+ }
162
+
163
+ // To ensure that no error events are dropped, print them to the
164
+ // console if they have no listeners.
165
+ } else if (endsWith(type, 'error')) {
166
+ // eslint-disable-next-line
167
+ console.error((data && data.error) || data || 'Empty error event')
168
+ }
169
+
170
+ return this
171
+ }
172
+
173
+ /**
174
+ * Returns a true if this instance of Evented or any forwardeed instances of Evented have a listener for the specified type.
175
+ *
176
+ * @param {string} type The event type
177
+ * @returns {boolean} `true` if there is at least one registered listener for specified event type, `false` otherwise
178
+ */
179
+ listens (type) {
180
+ return (
181
+ (this._listeners &&
182
+ this._listeners[type] &&
183
+ this._listeners[type].length > 0) ||
184
+ (this._oneTimeListeners &&
185
+ this._oneTimeListeners[type] &&
186
+ this._oneTimeListeners[type].length > 0) ||
187
+ (this._eventedParent && this._eventedParent.listens(type))
188
+ )
189
+ }
190
+
191
+ /**
192
+ * Bubble all events fired by this instance of Evented to this parent instance of Evented.
193
+ *
194
+ * @private
195
+ * @returns {Object} `this`
196
+ */
197
+ setEventedParent (parent, data) {
198
+ this._eventedParent = parent
199
+ this._eventedParentData = data
200
+
201
+ return this
202
+ }
203
+ }
204
+
205
+ export default Event
@@ -0,0 +1,37 @@
1
+ import util from './util'
2
+
3
+ export const getTag = function (img, tag) {
4
+ if (!util.imageHasData(img)) return;
5
+ return img.exifdata[tag];
6
+ }
7
+
8
+ export const getIptcTag = function (img, tag) {
9
+ if (!util.imageHasData(img)) return;
10
+ return img.iptcdata[tag];
11
+ }
12
+
13
+ export const getAllTags = function (img) {
14
+ if (!util.imageHasData(img)) return {};
15
+ var a,
16
+ data = img.exifdata,
17
+ tags = {};
18
+ for (a in data) {
19
+ if (data.hasOwnProperty(a)) {
20
+ tags[a] = data[a];
21
+ }
22
+ }
23
+ return tags;
24
+ }
25
+
26
+ export const getAllIptcTags = function (img) {
27
+ if (!imageHasData(img)) return {};
28
+ var a,
29
+ data = img.iptcdata,
30
+ tags = {};
31
+ for (a in data) {
32
+ if (data.hasOwnProperty(a)) {
33
+ tags[a] = data[a];
34
+ }
35
+ }
36
+ return tags;
37
+ }
@@ -0,0 +1,33 @@
1
+ export default {
2
+ 0x0000: "GPSVersionID",
3
+ 0x0001: "GPSLatitudeRef",
4
+ 0x0002: "GPSLatitude",
5
+ 0x0003: "GPSLongitudeRef",
6
+ 0x0004: "GPSLongitude",
7
+ 0x0005: "GPSAltitudeRef",
8
+ 0x0006: "GPSAltitude",
9
+ 0x0007: "GPSTimeStamp",
10
+ 0x0008: "GPSSatellites",
11
+ 0x0009: "GPSStatus",
12
+ 0x000A: "GPSMeasureMode",
13
+ 0x000B: "GPSDOP",
14
+ 0x000C: "GPSSpeedRef",
15
+ 0x000D: "GPSSpeed",
16
+ 0x000E: "GPSTrackRef",
17
+ 0x000F: "GPSTrack",
18
+ 0x0010: "GPSImgDirectionRef",
19
+ 0x0011: "GPSImgDirection",
20
+ 0x0012: "GPSMapDatum",
21
+ 0x0013: "GPSDestLatitudeRef",
22
+ 0x0014: "GPSDestLatitude",
23
+ 0x0015: "GPSDestLongitudeRef",
24
+ 0x0016: "GPSDestLongitude",
25
+ 0x0017: "GPSDestBearingRef",
26
+ 0x0018: "GPSDestBearing",
27
+ 0x0019: "GPSDestDistanceRef",
28
+ 0x001A: "GPSDestDistance",
29
+ 0x001B: "GPSProcessingMethod",
30
+ 0x001C: "GPSAreaInformation",
31
+ 0x001D: "GPSDateStamp",
32
+ 0x001E: "GPSDifferential"
33
+ };
@@ -0,0 +1,22 @@
1
+ export default {
2
+ 0x0100: "ImageWidth",
3
+ 0x0101: "ImageHeight",
4
+ 0x0102: "BitsPerSample",
5
+ 0x0103: "Compression",
6
+ 0x0106: "PhotometricInterpretation",
7
+ 0x0111: "StripOffsets",
8
+ 0x0112: "Orientation",
9
+ 0x0115: "SamplesPerPixel",
10
+ 0x0116: "RowsPerStrip",
11
+ 0x0117: "StripByteCounts",
12
+ 0x011A: "XResolution",
13
+ 0x011B: "YResolution",
14
+ 0x011C: "PlanarConfiguration",
15
+ 0x0128: "ResolutionUnit",
16
+ 0x0201: "JpegIFOffset", // When image format is JPEG, this value show offset to JPEG data stored.(aka "ThumbnailOffset" or "JPEGInterchangeFormat")
17
+ 0x0202: "JpegIFByteCount", // When image format is JPEG, this value shows data size of JPEG image (aka "ThumbnailLength" or "JPEGInterchangeFormatLength")
18
+ 0x0211: "YCbCrCoefficients",
19
+ 0x0212: "YCbCrSubSampling",
20
+ 0x0213: "YCbCrPositioning",
21
+ 0x0214: "ReferenceBlackWhite"
22
+ };
@@ -0,0 +1,16 @@
1
+ import {getData} from './parse_image'
2
+ import {getAllTags} from './exif'
3
+
4
+ export const getPhotoTags = (file) => {
5
+ return new Promise((resolve, reject) => {
6
+ getData(file, function (img, err) {
7
+ if (err) {
8
+ reject(err)
9
+ return
10
+ }
11
+ let info = getAllTags(img)
12
+ let exif = JSON.parse(JSON.stringify(info).replaceAll('\\u0000', '')) || {}
13
+ resolve(exif)
14
+ })
15
+ })
16
+ }
@@ -0,0 +1,12 @@
1
+ export default {
2
+ 0x78: 'caption',
3
+ 0x6E: 'credit',
4
+ 0x19: 'keywords',
5
+ 0x37: 'dateCreated',
6
+ 0x50: 'byline',
7
+ 0x55: 'bylineTitle',
8
+ 0x7A: 'captionWriter',
9
+ 0x69: 'headline',
10
+ 0x74: 'copyright',
11
+ 0x0F: 'category'
12
+ };