@mapcatch/util 2.0.4 → 2.0.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mapcatch/util",
3
- "version": "2.0.4",
3
+ "version": "2.0.5",
4
4
  "main": "./dist/catchUtil.min.esm.js",
5
5
  "repository": "",
6
6
  "author": "wanyanyan",
@@ -17,6 +17,26 @@
17
17
  "src/**/*.js": "yarn lint"
18
18
  },
19
19
  "dependencies": {
20
+ "@turf/turf": "^7.1.0",
21
+ "@xmldom/xmldom": "^0.9.2",
22
+ "cdt2d": "^1.0.0",
23
+ "eslint": "8.22.0",
24
+ "gl-matrix": "^3.4.3",
25
+ "glsl-float-to-rgba": "^1.0.0",
26
+ "glsl-rgba-to-float": "^1.0.0",
27
+ "lodash": "^4.17.21",
28
+ "mapbox-gl": "^3.6.0",
29
+ "mathjs": "12.3.0",
30
+ "moment": "^2.29.4",
31
+ "pbf": "3.2.1",
32
+ "proj4": "^2.12.1",
33
+ "protocol-buffers-schema": "^3.6.0",
34
+ "regl": "^2.1.0",
35
+ "satellite-geo-calc": "^0.0.7",
36
+ "spark-md5": "^3.0.2",
37
+ "svg-path-commander": "2.0.9",
38
+ "upng-js": "^2.1.0",
39
+ "uuid": "^9.0.0"
20
40
  },
21
41
  "devDependencies": {
22
42
  "@babel/core": "^7.25.2",
@@ -7,7 +7,9 @@ export default [
7
7
  opacity: 1,
8
8
  class: 'image2d',
9
9
  metadata: {
10
- folder: 'dom_tiles'
10
+ folder: 'dom_tiles',
11
+ show_annotations: true,
12
+ show_annotation_labels: true
11
13
  }
12
14
  },
13
15
  {
@@ -18,7 +20,11 @@ export default [
18
20
  opacity: 1,
19
21
  class: 'tmp',
20
22
  metadata: {
21
- folder: 'tem_tiles'
23
+ folder: 'tem_tiles',
24
+ borderStyle: 'transparent',
25
+ colorType: 'turbo',
26
+ show_annotations: true,
27
+ show_annotation_labels: true
22
28
  }
23
29
  },
24
30
  {
@@ -31,7 +37,9 @@ export default [
31
37
  metadata: {
32
38
  folder: 'dsm_tiles',
33
39
  borderStyle: 'transparent',
34
- colorType: 'turbo'
40
+ colorType: 'turbo',
41
+ show_annotations: true,
42
+ show_annotation_labels: true
35
43
  }
36
44
  },
37
45
  {
@@ -59,22 +67,24 @@ export default [
59
67
  class: 'photos'
60
68
  },
61
69
  {
62
- type: 'bndvi',
63
- name: '植被指数(BNDVI)',
70
+ type: 'ndvi',
71
+ name: 'NDVI',
64
72
  group: 'index',
65
73
  visible: true,
66
74
  opacity: 1,
67
- class: 'bndvi',
75
+ class: 'ndvi',
68
76
  metadata: {
69
- folder: 'bndvi_tiles',
77
+ folder: 'ndvi_tiles',
70
78
  borderStyle: 'transparent',
71
79
  colorType: 'red-green',
72
- bands: ['NIR', 'Blue']
80
+ bands: ['NIR', 'Red'],
81
+ show_annotations: true,
82
+ show_annotation_labels: true
73
83
  }
74
84
  },
75
85
  {
76
86
  type: 'gndvi',
77
- name: '植被指数(GNDVI',
87
+ name: 'GNDVI',
78
88
  group: 'index',
79
89
  visible: true,
80
90
  opacity: 1,
@@ -82,13 +92,15 @@ export default [
82
92
  metadata: {
83
93
  folder: 'gndvi_tiles',
84
94
  borderStyle: 'transparent',
85
- colorType: 'red-green',
86
- bands: ['NIR', 'Green']
95
+ colorType: 'glow',
96
+ bands: ['NIR', 'Green'],
97
+ show_annotations: true,
98
+ show_annotation_labels: true
87
99
  }
88
100
  },
89
101
  {
90
102
  type: 'lci',
91
- name: '植被指数(LCI',
103
+ name: 'LCI',
92
104
  group: 'index',
93
105
  visible: true,
94
106
  opacity: 1,
@@ -96,27 +108,15 @@ export default [
96
108
  metadata: {
97
109
  folder: 'lci_tiles',
98
110
  borderStyle: 'transparent',
99
- colorType: 'glow',
100
- bands: ['NIR', 'RedEdge', 'Red']
101
- }
102
- },
103
- {
104
- type: 'mcari',
105
- name: '植被指数(MCARI)',
106
- group: 'index',
107
- visible: true,
108
- opacity: 1,
109
- class: 'mcari',
110
- metadata: {
111
- folder: 'mcari_tiles',
112
- borderStyle: 'transparent',
113
111
  colorType: 'turbo',
114
- bands: ['NIR', 'Red', 'Green']
112
+ bands: ['NIR', 'RedEdge', 'Red'],
113
+ show_annotations: true,
114
+ show_annotation_labels: true
115
115
  }
116
116
  },
117
117
  {
118
118
  type: 'ndre',
119
- name: '植被指数(NDRE',
119
+ name: 'NDRE',
120
120
  group: 'index',
121
121
  visible: true,
122
122
  opacity: 1,
@@ -124,78 +124,26 @@ export default [
124
124
  metadata: {
125
125
  folder: 'ndre_tiles',
126
126
  borderStyle: 'transparent',
127
- colorType: 'red-green',
128
- bands: ['NIR', 'RedEdge']
127
+ colorType: 'gray',
128
+ bands: ['NIR', 'RedEdge'],
129
+ show_annotations: true,
130
+ show_annotation_labels: true
129
131
  }
130
132
  },
131
133
  {
132
- type: 'ndvi',
133
- name: '植被指数(NDVI)',
134
+ type: 'osavi',
135
+ name: 'OSAVI',
134
136
  group: 'index',
135
137
  visible: true,
136
138
  opacity: 1,
137
- class: 'ndvi',
139
+ class: 'osavi',
138
140
  metadata: {
139
- folder: 'ndvi_tiles',
141
+ folder: 'osavi_tiles',
140
142
  borderStyle: 'transparent',
141
143
  colorType: 'red-green',
142
- bands: ['NIR', 'Red']
143
- }
144
- },
145
- {
146
- type: 'sipi2',
147
- name: '植被指数(SIPI2)',
148
- group: 'index',
149
- visible: true,
150
- opacity: 1,
151
- class: 'sipi2',
152
- metadata: {
153
- folder: 'sipi2_tiles',
154
- borderStyle: 'transparent',
155
- colorType: 'glow',
156
- bands: ['NIR', 'Green']
157
- }
158
- },
159
- {
160
- type: 'tgi',
161
- name: '植被指数(TGI)',
162
- group: 'index',
163
- visible: true,
164
- opacity: 1,
165
- class: 'tgi',
166
- metadata: {
167
- folder: 'tgi_tiles',
168
- borderStyle: 'transparent',
169
- colorType: 'turbo',
170
- bands: ['Red', 'Green', 'Blue']
171
- }
172
- },
173
- {
174
- type: 'vari',
175
- name: '植被指数(VARI)',
176
- group: 'index',
177
- visible: true,
178
- opacity: 1,
179
- class: 'vari',
180
- metadata: {
181
- folder: 'vari_tiles',
182
- borderStyle: 'transparent',
183
- colorType: 'red-green',
184
- bands: ['Red', 'Green', 'Blue']
185
- }
186
- },
187
- {
188
- type: 'ndmi',
189
- name: '植被指数(NDMI)',
190
- group: 'index',
191
- visible: true,
192
- opacity: 1,
193
- class: 'ndmi',
194
- metadata: {
195
- folder: 'ndmi_tiles',
196
- borderStyle: 'transparent',
197
- colorType: 'glow',
198
- bands: ['NIR', 'SWIR_1613', 'Blue']
144
+ bands: ['NIR', 'Red'],
145
+ show_annotations: true,
146
+ show_annotation_labels: true
199
147
  }
200
148
  }
201
149
  ]
package/src/util.js CHANGED
@@ -370,12 +370,20 @@ export function getLineLabelFeature (lineFeature) {
370
370
  * @param {*} icons 要添加的图标列表,包含图标的url以及是否作为sdf符号
371
371
  */
372
372
  export function addIcons2Map (map, icons) {
373
- icons.forEach(({url, sdf}) => {
374
- map.loadImage(url, (error, image) => {
375
- let iconName = url.split('/').pop().split('.')[0]
376
- if(map.hasImage(iconName)) return
377
- if (error) throw error
378
- map.addImage(iconName, image, {sdf})
373
+ return new Promise((resolve, reject) => {
374
+ let cnt = icons.length
375
+ icons.forEach(({url, sdf}) => {
376
+ map.loadImage(url, (error, image) => {
377
+ cnt--
378
+ let iconName = url.split('/').pop().split('.')[0]
379
+ if(map.hasImage(iconName)) return
380
+ if (error) {
381
+ reject(error)
382
+ return
383
+ }
384
+ map.addImage(iconName, image, {sdf})
385
+ if (cnt <= 0) resolve(true)
386
+ })
379
387
  })
380
388
  })
381
389
  }