@kalisio/kdk 1.5.0 → 1.5.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.
- package/CHANGELOG.md +46 -8
- package/lib/core/client/reader.js.map +1 -1
- package/lib/core/client/readers/reader.csv.js.map +1 -1
- package/lib/map/client/mixins/map/mixin.geojson-layers.js +6 -1
- package/lib/map/client/mixins/map/mixin.geojson-layers.js.map +1 -1
- package/lib/map/client/readers/reader.geojson.js.map +1 -1
- package/lib/map/client/readers/reader.gpx.js.map +1 -1
- package/lib/map/client/readers/reader.kml.js.map +1 -1
- package/package.json +1 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [v1.5.0](https://github.com/kalisio/kdk/tree/v1.5.0) (2022-01-07)
|
|
4
|
+
|
|
5
|
+
[Full Changelog](https://github.com/kalisio/kdk/compare/v1.4.2...v1.5.0)
|
|
6
|
+
|
|
7
|
+
**Implemented enhancements:**
|
|
8
|
+
|
|
9
|
+
- The capture action should take into account the current activity \(map or globe\) [\#507](https://github.com/kalisio/kdk/issues/507)
|
|
10
|
+
- Handle the current time within the map context [\#503](https://github.com/kalisio/kdk/issues/503)
|
|
11
|
+
- Features filter should sort the list of values alphabetically to ease selection [\#405](https://github.com/kalisio/kdk/issues/405)
|
|
12
|
+
- Provide measurements capabilities [\#359](https://github.com/kalisio/kdk/issues/359)
|
|
13
|
+
|
|
14
|
+
**Fixed bugs:**
|
|
15
|
+
|
|
16
|
+
- Content filter does not work on items in an array [\#512](https://github.com/kalisio/kdk/issues/512)
|
|
17
|
+
- Layer selector should not be wrapped [\#509](https://github.com/kalisio/kdk/issues/509)
|
|
18
|
+
- User context not correctly restored from URL for a single layer [\#506](https://github.com/kalisio/kdk/issues/506)
|
|
19
|
+
- Built-in layers should not be part of user context [\#505](https://github.com/kalisio/kdk/issues/505)
|
|
20
|
+
- The capture action should take into account the current time [\#504](https://github.com/kalisio/kdk/issues/504)
|
|
21
|
+
- Editing layer style : Marker color selector won't preselect the current color [\#502](https://github.com/kalisio/kdk/issues/502)
|
|
22
|
+
- Edit layer style : Adding space in Tooltip between text and drop menu [\#501](https://github.com/kalisio/kdk/issues/501)
|
|
23
|
+
- None of Popup, Tooltip and Information box display option working in style editor [\#499](https://github.com/kalisio/kdk/issues/499)
|
|
24
|
+
- Station properties lost when a measure is available [\#510](https://github.com/kalisio/kdk/issues/510)
|
|
25
|
+
|
|
26
|
+
**Merged pull requests:**
|
|
27
|
+
|
|
28
|
+
- chore\(deps\): bump mermaid from 8.13.5 to 8.13.8 in /docs [\#513](https://github.com/kalisio/kdk/pull/513) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
29
|
+
- chore\(deps\): bump mermaid from 8.8.4 to 8.13.5 in /docs [\#498](https://github.com/kalisio/kdk/pull/498) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
30
|
+
|
|
3
31
|
## [v1.4.2](https://github.com/kalisio/kdk/tree/v1.4.2) (2021-12-09)
|
|
4
32
|
|
|
5
33
|
[Full Changelog](https://github.com/kalisio/kdk/compare/v1.4.1...v1.4.2)
|
|
@@ -14,10 +42,22 @@
|
|
|
14
42
|
|
|
15
43
|
[Full Changelog](https://github.com/kalisio/kdk/compare/v1.4.0...v1.4.1)
|
|
16
44
|
|
|
45
|
+
**Implemented enhancements:**
|
|
46
|
+
|
|
47
|
+
- Add export data action in timeseries widget [\#491](https://github.com/kalisio/kdk/issues/491)
|
|
48
|
+
- Enhance feature aggregation to manage forecast data [\#488](https://github.com/kalisio/kdk/issues/488)
|
|
49
|
+
- Provide a map capture component [\#487](https://github.com/kalisio/kdk/issues/487)
|
|
50
|
+
- The import component does not allow to import GPX [\#484](https://github.com/kalisio/kdk/issues/484)
|
|
51
|
+
- Homogenize client side file reading [\#483](https://github.com/kalisio/kdk/issues/483)
|
|
52
|
+
- When dropping/importing a GeoJSON file we should zoom to the given bbox if defined [\#475](https://github.com/kalisio/kdk/issues/475)
|
|
53
|
+
- Improve online help [\#33](https://github.com/kalisio/kdk/issues/33)
|
|
54
|
+
- Feature aggregation is slow [\#81](https://github.com/kalisio/kdk/issues/81)
|
|
55
|
+
|
|
17
56
|
**Fixed bugs:**
|
|
18
57
|
|
|
19
58
|
- Draw mode in location input exhibits a location marker [\#494](https://github.com/kalisio/kdk/issues/494)
|
|
20
59
|
- asGeoJson hook does not handle geometry collection [\#493](https://github.com/kalisio/kdk/issues/493)
|
|
60
|
+
- getContextParameters in mixin.context should filter system layers and temporary layers [\#492](https://github.com/kalisio/kdk/issues/492)
|
|
21
61
|
- asGeoJson hook does not return geometry if longitude/latitude properties are also available [\#486](https://github.com/kalisio/kdk/issues/486)
|
|
22
62
|
- Impossible to import map layer with self-intersecting lines [\#485](https://github.com/kalisio/kdk/issues/485)
|
|
23
63
|
- KColumn does not handle pagination correctly [\#482](https://github.com/kalisio/kdk/issues/482)
|
|
@@ -88,6 +128,7 @@
|
|
|
88
128
|
- chore\(deps\): bump url-parse from 1.5.1 to 1.5.3 in /docs [\#441](https://github.com/kalisio/kdk/pull/441) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
89
129
|
- chore\(deps\): bump path-parse from 1.0.6 to 1.0.7 in /docs [\#440](https://github.com/kalisio/kdk/pull/440) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
90
130
|
- chore\(deps\): bump path-parse from 1.0.6 to 1.0.7 [\#439](https://github.com/kalisio/kdk/pull/439) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
131
|
+
- chore\(deps\): bump sanitize-html from 1.27.1 to 2.3.2 [\#353](https://github.com/kalisio/kdk/pull/353) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
91
132
|
|
|
92
133
|
## [v1.3.6](https://github.com/kalisio/kdk/tree/v1.3.6) (2021-07-15)
|
|
93
134
|
|
|
@@ -98,10 +139,6 @@
|
|
|
98
139
|
- Style editor should allow to control layer visibility in globe [\#429](https://github.com/kalisio/kdk/issues/429)
|
|
99
140
|
- Add filtering capabilities in OWS layer field [\#428](https://github.com/kalisio/kdk/issues/428)
|
|
100
141
|
|
|
101
|
-
**Fixed bugs:**
|
|
102
|
-
|
|
103
|
-
- KItemField clears the input pattern when an item is found [\#421](https://github.com/kalisio/kdk/issues/421)
|
|
104
|
-
|
|
105
142
|
## [v1.3.5](https://github.com/kalisio/kdk/tree/v1.3.5) (2021-07-02)
|
|
106
143
|
|
|
107
144
|
[Full Changelog](https://github.com/kalisio/kdk/compare/v1.3.4...v1.3.5)
|
|
@@ -126,6 +163,7 @@
|
|
|
126
163
|
**Fixed bugs:**
|
|
127
164
|
|
|
128
165
|
- Gradient path width changes with min/max map zoom [\#424](https://github.com/kalisio/kdk/issues/424)
|
|
166
|
+
- KItemField clears the input pattern when an item is found [\#421](https://github.com/kalisio/kdk/issues/421)
|
|
129
167
|
- When filtering a collection the pattern is cleared if a filter item is found [\#420](https://github.com/kalisio/kdk/issues/420)
|
|
130
168
|
- Changing the geometry type in realtime GeoJson layer does not work [\#406](https://github.com/kalisio/kdk/issues/406)
|
|
131
169
|
- Minimize and maximize actions seem mixed up on KWindow [\#402](https://github.com/kalisio/kdk/issues/402)
|
|
@@ -257,7 +295,6 @@
|
|
|
257
295
|
- Improve timeseries widget readability [\#305](https://github.com/kalisio/kdk/issues/305)
|
|
258
296
|
- Search by item does not take service context into account [\#294](https://github.com/kalisio/kdk/issues/294)
|
|
259
297
|
- Probe tooltip displayed when a feature has a weather property [\#280](https://github.com/kalisio/kdk/issues/280)
|
|
260
|
-
- Complex service requests do not work in HTTP mode [\#138](https://github.com/kalisio/kdk/issues/138)
|
|
261
298
|
- Location indicator not updated when navigating with keyboard [\#124](https://github.com/kalisio/kdk/issues/124)
|
|
262
299
|
- asGeoJson hook breaks reactivity [\#79](https://github.com/kalisio/kdk/issues/79)
|
|
263
300
|
|
|
@@ -277,12 +314,10 @@
|
|
|
277
314
|
- Provide an activity bar [\#282](https://github.com/kalisio/kdk/issues/282)
|
|
278
315
|
- Keep track of currently activated layers [\#268](https://github.com/kalisio/kdk/issues/268)
|
|
279
316
|
- Cannot fetch data for archived weather layer [\#259](https://github.com/kalisio/kdk/issues/259)
|
|
280
|
-
- Member activity should not allow to update tag icon/color once created [\#254](https://github.com/kalisio/kdk/issues/254)
|
|
281
317
|
- Cannot save GeoJson with invalid geometries [\#251](https://github.com/kalisio/kdk/issues/251)
|
|
282
318
|
- Allow tiled layers with multiple grid sources to have multiple min/max zoom values. [\#250](https://github.com/kalisio/kdk/issues/250)
|
|
283
319
|
- Simplify meteo model configuration in tiled layers [\#241](https://github.com/kalisio/kdk/issues/241)
|
|
284
320
|
- Feature tooltip/popup must be translatable [\#216](https://github.com/kalisio/kdk/issues/216)
|
|
285
|
-
- Support tiling for feature layers in map [\#82](https://github.com/kalisio/kdk/issues/82)
|
|
286
321
|
|
|
287
322
|
**Fixed bugs:**
|
|
288
323
|
|
|
@@ -307,6 +342,7 @@
|
|
|
307
342
|
- Handle checking an alert without available data [\#265](https://github.com/kalisio/kdk/issues/265)
|
|
308
343
|
- Location field display of location without a name is incorrect [\#264](https://github.com/kalisio/kdk/issues/264)
|
|
309
344
|
- User should be able to disable geolocation using the navigation bar [\#258](https://github.com/kalisio/kdk/issues/258)
|
|
345
|
+
- Member activity should not allow to update tag icon/color once created [\#254](https://github.com/kalisio/kdk/issues/254)
|
|
310
346
|
- Multiple variables using the same color in timeseries widget [\#244](https://github.com/kalisio/kdk/issues/244)
|
|
311
347
|
- Filter members from tags/groups activity [\#228](https://github.com/kalisio/kdk/issues/228)
|
|
312
348
|
- Allow layer variable definition to customise axis options in timeseries [\#224](https://github.com/kalisio/kdk/issues/224)
|
|
@@ -438,12 +474,12 @@
|
|
|
438
474
|
- Merge kdk modules into a single module [\#65](https://github.com/kalisio/kdk/issues/65)
|
|
439
475
|
- Allow to run e2e on the targeted deployment platform [\#62](https://github.com/kalisio/kdk/issues/62)
|
|
440
476
|
- Allow to apply the CI process when working on a branch [\#61](https://github.com/kalisio/kdk/issues/61)
|
|
477
|
+
- Support tiling for feature layers in map [\#82](https://github.com/kalisio/kdk/issues/82)
|
|
441
478
|
- Improve application webhook security [\#84](https://github.com/kalisio/kdk/issues/84)
|
|
442
479
|
- Upgrade to latest Node.js LTS [\#48](https://github.com/kalisio/kdk/issues/48)
|
|
443
480
|
- Allow to filter feature layers [\#89](https://github.com/kalisio/kdk/issues/89)
|
|
444
481
|
- Enhance e2e tests across the modules/apps [\#38](https://github.com/kalisio/kdk/issues/38)
|
|
445
482
|
- Optimize measure update for time-stamped features in globe [\#96](https://github.com/kalisio/kdk/issues/96)
|
|
446
|
-
- Create a component to provide styling options for feature layers in map [\#110](https://github.com/kalisio/kdk/issues/110)
|
|
447
483
|
- Manage real-time and archive/forecast mode [\#108](https://github.com/kalisio/kdk/issues/108)
|
|
448
484
|
- Code coverage not correctly pushed to Code Climate in travis application builds [\#51](https://github.com/kalisio/kdk/issues/51)
|
|
449
485
|
|
|
@@ -466,6 +502,7 @@
|
|
|
466
502
|
- Missing zero values in tooltip display [\#141](https://github.com/kalisio/kdk/issues/141)
|
|
467
503
|
- Error raised on clustered tile layers [\#140](https://github.com/kalisio/kdk/issues/140)
|
|
468
504
|
- Timeseries do not update correctly when changing time [\#139](https://github.com/kalisio/kdk/issues/139)
|
|
505
|
+
- Complex service requests do not work in HTTP mode [\#138](https://github.com/kalisio/kdk/issues/138)
|
|
469
506
|
- Timeseries widget not synchronized when disabling/removing a layer [\#135](https://github.com/kalisio/kdk/issues/135)
|
|
470
507
|
- Openers shoud be displayed only a component is assgined to the drawers or footer [\#131](https://github.com/kalisio/kdk/issues/131)
|
|
471
508
|
- min zoom level not correctly handled in tiled map layers [\#126](https://github.com/kalisio/kdk/issues/126)
|
|
@@ -536,6 +573,7 @@
|
|
|
536
573
|
|
|
537
574
|
**Implemented enhancements:**
|
|
538
575
|
|
|
576
|
+
- Create a component to provide styling options for feature layers in map [\#110](https://github.com/kalisio/kdk/issues/110)
|
|
539
577
|
- Migrate the documentation to VuePress [\#30](https://github.com/kalisio/kdk/issues/30)
|
|
540
578
|
- Change props 'id' by 'objectId' [\#27](https://github.com/kalisio/kdk/issues/27)
|
|
541
579
|
- Add slack notifications from Travis CI [\#24](https://github.com/kalisio/kdk/issues/24)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../core/client/reader.js"],"names":["Reader","readers","register","mimeType","reader","read","file","options","fileExtension","path","extname","name","content","error","Events","$emit","message","i18next","t","Error","getSupportedFormats","Object","keys"],"mappings":";;;;;;;AAAA;;;;AACA;;;;AACA;;;;;;AAEA;AACO,MAAMA,0BAAS;AACpBC,WAAS,EADW;AAEpBC,WAAUC,QAAV,EAAoBC,MAApB,EAA4B;AAC1B,SAAKH,OAAL,CAAaE,QAAb,IAAyBC,MAAzB;AACD,GAJmB;AAKdC,MAAN,CAAYC,IAAZ,EAAkBC,OAAlB,EAA2B;AAAA;;AAAA;AACzB,YAAMC,gBAAgBC,eAAKC,OAAL,CAAaJ,KAAKK,IAAlB,CAAtB;AACA,YAAMP,SAAS,MAAKH,OAAL,CAAaO,aAAb,CAAf;AACA,UAAIJ,MAAJ,EAAY;AACV,YAAI;AACF,gBAAMQ,UAAU,MAAMR,OAAOE,IAAP,EAAaC,OAAb,CAAtB;AACA,iBAAOK,OAAP;AACD,SAHD,CAGE,OAAOC,KAAP,EAAc;AACdC,yBAAOC,KAAP,CAAa,OAAb,EAAsBF,KAAtB;AACA,gBAAMA,KAAN;AACD;AACF;AACD,YAAMA,QAAQ;AACZG,iBAASC,kBAAQC,CAAR,CAAU,gCAAV,EAA4C,EAAEZ,MAAMA,KAAKK,IAAb,EAA5C;AADG,OAAd;AAGAG,qBAAOC,KAAP,CAAa,OAAb,EAAsBF,KAAtB;AACA,YAAM,IAAIM,KAAJ,CAAUN,KAAV,CAAN;AAhByB;AAiB1B,GAtBmB;AAuBpBO,wBAAuB;AACrB,WAAOC,OAAOC,IAAP,CAAY,KAAKrB,OAAjB,CAAP;AACD;AAzBmB,CAAf","file":"reader.js","sourcesContent":["import path from 'path'\r\nimport i18next from 'i18next'\r\nimport { Events } from './events'\r\n\r\n// Export singleton\r\nexport const Reader = {\r\n readers: {},\r\n register (mimeType, reader) {\r\n this.readers[mimeType] = reader\r\n },\r\n async read (file, options) {\r\n const fileExtension = path.extname(file.name)\r\n const reader = this.readers[fileExtension]\r\n if (reader) {\r\n try {\r\n const content = await reader(file, options)\r\n return content\r\n } catch (error) {\r\n Events.$emit('error', error)\r\n throw error\r\n }\r\n }\r\n const error = {\r\n message: i18next.t('errors.UNSUPPORTED_FILE_FORMAT', { file: file.name })\r\n }\r\n Events.$emit('error', error)\r\n throw new Error(error)\r\n },\r\n getSupportedFormats () {\r\n return Object.keys(this.readers)\r\n }\r\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../core/client/reader.js"],"names":["Reader","readers","register","mimeType","reader","read","file","options","fileExtension","path","extname","name","content","error","Events","$emit","message","i18next","t","Error","getSupportedFormats","Object","keys"],"mappings":";;;;;;;AAAA;;;;AACA;;;;AACA;;;;;;AAEA;AACO,MAAMA,0BAAS;AACpBC,WAAS,EADW;AAEpBC,WAAUC,QAAV,EAAoBC,MAApB,EAA4B;AAC1B,SAAKH,OAAL,CAAaE,QAAb,IAAyBC,MAAzB;AACD,GAJmB;AAKdC,MAAN,CAAYC,IAAZ,EAAkBC,OAAlB,EAA2B;AAAA;;AAAA;AACzB,YAAMC,gBAAgBC,eAAKC,OAAL,CAAaJ,KAAKK,IAAlB,CAAtB;AACA,YAAMP,SAAS,MAAKH,OAAL,CAAaO,aAAb,CAAf;AACA,UAAIJ,MAAJ,EAAY;AACV,YAAI;AACF,gBAAMQ,UAAU,MAAMR,OAAOE,IAAP,EAAaC,OAAb,CAAtB;AACA,iBAAOK,OAAP;AACD,SAHD,CAGE,OAAOC,KAAP,EAAc;AACdC,yBAAOC,KAAP,CAAa,OAAb,EAAsBF,KAAtB;AACA,gBAAMA,KAAN;AACD;AACF;AACD,YAAMA,QAAQ;AACZG,iBAASC,kBAAQC,CAAR,CAAU,gCAAV,EAA4C,EAAEZ,MAAMA,KAAKK,IAAb,EAA5C;AADG,OAAd;AAGAG,qBAAOC,KAAP,CAAa,OAAb,EAAsBF,KAAtB;AACA,YAAM,IAAIM,KAAJ,CAAUN,KAAV,CAAN;AAhByB;AAiB1B,GAtBmB;AAuBpBO,wBAAuB;AACrB,WAAOC,OAAOC,IAAP,CAAY,KAAKrB,OAAjB,CAAP;AACD;AAzBmB,CAAf","file":"reader.js","sourcesContent":["import path from 'path'\r\nimport i18next from 'i18next'\r\nimport { Events } from './events'\r\n\r\n// Export singleton\r\nexport const Reader = {\r\n readers: {},\r\n register (mimeType, reader) {\r\n this.readers[mimeType] = reader\r\n },\r\n async read (file, options) {\r\n const fileExtension = path.extname(file.name)\r\n const reader = this.readers[fileExtension]\r\n if (reader) {\r\n try {\r\n const content = await reader(file, options)\r\n return content\r\n } catch (error) {\r\n Events.$emit('error', error)\r\n throw error\r\n }\r\n }\r\n const error = {\r\n message: i18next.t('errors.UNSUPPORTED_FILE_FORMAT', { file: file.name })\r\n }\r\n Events.$emit('error', error)\r\n throw new Error(error)\r\n },\r\n getSupportedFormats () {\r\n return Object.keys(this.readers)\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../core/client/readers/reader.csv.js"],"names":["readCSV","file","options","Promise","resolve","reject","reader","FileReader","onloadend","content","result","papaParseOptions","Object","assign","skipEmptyLines","Papa","parse","errors","length","logger","debug","Error","i18next","t","name","onerror","error","readAsText"],"mappings":";;;;;QAIgBA,O,GAAAA,O;;AAJhB;;;;AACA;;;;AACA;;;;;;AAEO,SAASA,OAAT,CAAkBC,IAAlB,EAAwBC,OAAxB,EAAiC;AACtC,SAAO,IAAIC,OAAJ,CAAY,CAACC,OAAD,EAAUC,MAAV,KAAqB;AACtC,UAAMC,SAAS,IAAIC,UAAJ,EAAf;AACAD,WAAOE,SAAP,GAAmB,MAAM;AACvB,UAAIC,UAAUH,OAAOI,MAArB;AACA,YAAMC,mBAAmBC,OAAOC,MAAP,CAAc,EAAEC,gBAAgB,IAAlB,EAAd,EAAwCZ,OAAxC,CAAzB;AACAO,gBAAUM,oBAAKC,KAAL,CAAWP,OAAX,EAAoBE,gBAApB,CAAV;AACA,UAAIF,QAAQQ,MAAR,CAAeC,MAAf,GAAwB,CAA5B,EAA+B;AAC7BC,2BAAOC,KAAP,CAAaX,QAAQQ,MAArB;AACAZ,eAAO,IAAIgB,KAAJ,CAAUC,kBAAQC,CAAR,CAAU,yBAAV,EAAqC,EAAEtB,MAAMA,KAAKuB,IAAb,EAArC,CAAV,EAAqE,EAAEP,QAAQR,QAAQQ,MAAlB,EAArE,CAAP;AACA;AACD;AACDb,cAAQK,OAAR;AACD,KAVD;AAWAH,WAAOmB,OAAP,GAAkBC,KAAD,IAAW;AAC1BP,yBAAOC,KAAP,CAAaM,KAAb;AACArB,aAAO,IAAIgB,KAAJ,CAAUC,kBAAQC,CAAR,CAAU,yBAAV,EAAqC,EAAEtB,MAAMA,KAAKuB,IAAb,EAArC,CAAV,EAAqE,EAAEP,QAAQS,KAAV,EAArE,CAAP;AACD,KAHD;AAIApB,WAAOqB,UAAP,CAAkB1B,IAAlB;AACD,GAlBM,CAAP;AAmBD","file":"reader.csv.js","sourcesContent":["import logger from 'loglevel'\r\nimport i18next from 'i18next'\r\nimport Papa from 'papaparse'\r\n\r\nexport function readCSV (file, options) {\r\n return new Promise((resolve, reject) => {\r\n const reader = new FileReader()\r\n reader.onloadend = () => {\r\n let content = reader.result\r\n const papaParseOptions = Object.assign({ skipEmptyLines: true }, options)\r\n content = Papa.parse(content, papaParseOptions)\r\n if (content.errors.length > 0) {\r\n logger.debug(content.errors)\r\n reject(new Error(i18next.t('errors.INVALID_CSV_FILE', { file: file.name }), { errors: content.errors }))\r\n return\r\n }\r\n resolve(content)\r\n }\r\n reader.onerror = (error) => {\r\n logger.debug(error)\r\n reject(new Error(i18next.t('errors.CANNOT_READ_FILE', { file: file.name }), { errors: error }))\n }\r\n reader.readAsText(file)\r\n })\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../../core/client/readers/reader.csv.js"],"names":["readCSV","file","options","Promise","resolve","reject","reader","FileReader","onloadend","content","result","papaParseOptions","Object","assign","skipEmptyLines","Papa","parse","errors","length","logger","debug","Error","i18next","t","name","onerror","error","readAsText"],"mappings":";;;;;QAIgBA,O,GAAAA,O;;AAJhB;;;;AACA;;;;AACA;;;;;;AAEO,SAASA,OAAT,CAAkBC,IAAlB,EAAwBC,OAAxB,EAAiC;AACtC,SAAO,IAAIC,OAAJ,CAAY,CAACC,OAAD,EAAUC,MAAV,KAAqB;AACtC,UAAMC,SAAS,IAAIC,UAAJ,EAAf;AACAD,WAAOE,SAAP,GAAmB,MAAM;AACvB,UAAIC,UAAUH,OAAOI,MAArB;AACA,YAAMC,mBAAmBC,OAAOC,MAAP,CAAc,EAAEC,gBAAgB,IAAlB,EAAd,EAAwCZ,OAAxC,CAAzB;AACAO,gBAAUM,oBAAKC,KAAL,CAAWP,OAAX,EAAoBE,gBAApB,CAAV;AACA,UAAIF,QAAQQ,MAAR,CAAeC,MAAf,GAAwB,CAA5B,EAA+B;AAC7BC,2BAAOC,KAAP,CAAaX,QAAQQ,MAArB;AACAZ,eAAO,IAAIgB,KAAJ,CAAUC,kBAAQC,CAAR,CAAU,yBAAV,EAAqC,EAAEtB,MAAMA,KAAKuB,IAAb,EAArC,CAAV,EAAqE,EAAEP,QAAQR,QAAQQ,MAAlB,EAArE,CAAP;AACA;AACD;AACDb,cAAQK,OAAR;AACD,KAVD;AAWAH,WAAOmB,OAAP,GAAkBC,KAAD,IAAW;AAC1BP,yBAAOC,KAAP,CAAaM,KAAb;AACArB,aAAO,IAAIgB,KAAJ,CAAUC,kBAAQC,CAAR,CAAU,yBAAV,EAAqC,EAAEtB,MAAMA,KAAKuB,IAAb,EAArC,CAAV,EAAqE,EAAEP,QAAQS,KAAV,EAArE,CAAP;AACD,KAHD;AAIApB,WAAOqB,UAAP,CAAkB1B,IAAlB;AACD,GAlBM,CAAP;AAmBD","file":"reader.csv.js","sourcesContent":["import logger from 'loglevel'\r\nimport i18next from 'i18next'\r\nimport Papa from 'papaparse'\r\n\r\nexport function readCSV (file, options) {\r\n return new Promise((resolve, reject) => {\r\n const reader = new FileReader()\r\n reader.onloadend = () => {\r\n let content = reader.result\r\n const papaParseOptions = Object.assign({ skipEmptyLines: true }, options)\r\n content = Papa.parse(content, papaParseOptions)\r\n if (content.errors.length > 0) {\r\n logger.debug(content.errors)\r\n reject(new Error(i18next.t('errors.INVALID_CSV_FILE', { file: file.name }), { errors: content.errors }))\r\n return\r\n }\r\n resolve(content)\r\n }\r\n reader.onerror = (error) => {\r\n logger.debug(error)\r\n reject(new Error(i18next.t('errors.CANNOT_READ_FILE', { file: file.name }), { errors: error }))\r\n }\r\n reader.readAsText(file)\r\n })\r\n}\r\n"]}
|
|
@@ -105,7 +105,12 @@ exports.default = {
|
|
|
105
105
|
}
|
|
106
106
|
const oldProperties = _lodash2.default.get(oldLayer, 'feature.properties');
|
|
107
107
|
const properties = _lodash2.default.get(feature, 'properties');
|
|
108
|
-
|
|
108
|
+
// Keep track of old properties
|
|
109
|
+
if (oldProperties && properties) {
|
|
110
|
+
_lodash2.default.forOwn(oldProperties, (value, key) => {
|
|
111
|
+
if (!_lodash2.default.has(properties, key)) _lodash2.default.set(properties, key, value);
|
|
112
|
+
});
|
|
113
|
+
}
|
|
109
114
|
if (oldLayer.setIcon) {
|
|
110
115
|
// FIXME: updating icon in place requires to recreate it anyway, so for now we recreate the whole marker
|
|
111
116
|
// oldLayer.setIcon(_.get(leafletOptions.pointToLayer(feature, oldLayer.getLatLng()), 'options.icon'))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../map/client/mixins/map/mixin.geojson-layers.js"],"names":["wfs","geometryToLayer","L","GeoJSON","geojson","options","geometry","properties","geodesic","type","Geodesic","coordsToLatLngs","coordinates","Object","assign","steps","style","layer","fill","createCircle","coordsToLatLng","radius","gradient","GradientPath","mask","MaskLayer","methods","processRealtimeGeoJsonLayerOptions","leafletOptions","leaflet","id","_","get","set","feature","container","createLeafletLayer","has","updateFeature","oldLayer","onEachFeature","setStyle","oldProperties","setIcon","staticGeometry","oldType","setLatLng","setData","setLatLngs","service","tiled","removeMissing","successCallback","errorCallback","featureSource","baseQuery","getFeatures","merge","probeService","initialized","lastUpdateTime","getProbeFeatures","error","shouldSkipFeaturesUpdate","Time","getCurrentTime","clone","query","searchParams","OUTPUTFORMAT","outputFormat","SRSNAME","BBOX","south","west","north","east","GetFeature","url","version","xml2json","sourceCompiler","template","lastFetchedSource","sourceToFetch","time","processGeoJsonLayerOptions","dataSource","isNil","features","data","processClusterLayerOptions","cluster","createLeafletGeoJsonLayer","activityOptions","engine","realtime","layerStyleTemplate","map","property","compiler","popupTemplate","popup","tooltipTemplate","tooltip","geoJsonOptions","getGeoJsonOptions","keys","forEach","key","layerStyle","convertFromSimpleStyleSpec","tiledLayer","TiledFeatureLayer","setup","on","addTo","removeFrom","$emit","leafletLayer","once","toGeoJSON","values","_features","clearLayers","_onNewData","addLayer","geoJsonLayer","update","timeDimension","source","logger","geojsonOptions","LeafletEvents","Feature","onLeafletFeature","getPopup","unbindPopup","generateStyle","wasOpen","isPopupOpen","bindPopup","Popup","openPopup","getTooltip","unbindTooltip","isTooltipOpen","bindTooltip","Tooltip","openTooltip","pointToLayer","latlng","updateLayer","name","geoJson","remove","getLeafletLayerByName","getLayers","find","_container","filter","getLayer","getFeatureId","toGeoJson","onCurrentTimeChangedGeoJsonLayers","geoJsonlayers","layers","$or","$exists","variables","isVisible","geoJsonlayer","redraw","created","registerLeafletConstructor","$events","$on","beforeDestroy","$off","onCurrentTimeChangedHeatmapLayers"],"mappings":";;;;;;AAAA;;;;AACA;;;;AACA;;;;AACA;;;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;IA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+D,YAAN,EAAsB;AAC1C;AACA,gBAAM1J,QAAQ,OAAK2I,qBAAL,CAA2Be,aAAalB,IAAxC,CAAd;AACA;AACA,cAAIxI,MAAM+F,UAAV,EAAsB/F,MAAM+F,UAAN,CAAiB4D,MAAjB,GAAtB,KACK3J,MAAM+G,MAAN;AACN,SAND;;AAAA;AAAA;AAAA;AAAA;AAOD;AAzUM,GADI;AA4Ub6C,YAAW;AACT,SAAKC,0BAAL,CAAgC,KAAKjF,yBAArC;AACA,SAAKkF,OAAL,CAAaC,GAAb,CAAiB,2BAAjB,EAA8C,KAAKZ,iCAAnD;AACD,GA/UY;AAgVba,kBAAiB;AACf,SAAKF,OAAL,CAAaG,IAAb,CAAkB,2BAAlB,EAA+C,KAAKC,iCAApD;AACD;AAlVY,C","file":"mixin.geojson-layers.js","sourcesContent":["import L from 'leaflet'\r\nimport _ from 'lodash'\r\nimport sift from 'sift'\r\nimport logger from 'loglevel'\r\nimport 'leaflet-realtime'\r\nimport { Time } from '../../../../core/client/time'\r\nimport { GradientPath } from '../../leaflet/GradientPath'\r\nimport { MaskLayer } from '../../leaflet/MaskLayer'\r\nimport { TiledFeatureLayer } from '../../leaflet/TiledFeatureLayer'\r\nimport { fetchGeoJson, LeafletEvents, bindLeafletEvents, unbindLeafletEvents } from '../../utils'\r\nimport * as wfs from '../../../common/wfs-utils'\r\n\r\n// Override default Leaflet GeoJson utility to manage some specific use cases\r\nconst geometryToLayer = L.GeoJSON.geometryToLayer\r\nL.GeoJSON.geometryToLayer = function (geojson, options) {\r\n const geometry = geojson.geometry\r\n const properties = geojson.properties\r\n if (geometry && properties && properties.geodesic) {\r\n if (geometry.type === 'LineString') {\r\n return new L.Geodesic([L.GeoJSON.coordsToLatLngs(geometry.coordinates, 0)],\r\n Object.assign({ steps: 100 }, options.style(geojson)))\r\n } else if (geometry.type === 'Point') {\r\n const layer = new L.Geodesic([], Object.assign({ fill: true, steps: 360 }, options.style(geojson)))\r\n layer.createCircle(L.GeoJSON.coordsToLatLng(geometry.coordinates), properties.radius)\r\n return layer\r\n }\r\n }\r\n if (geometry && properties && properties.gradient) {\r\n if (geometry.type === 'LineString') {\r\n return new GradientPath(geojson, options.style(geojson))\r\n }\r\n }\r\n if (geometry && properties && properties.mask) {\r\n if (geometry.type === 'Polygon' || geometry.type === 'MultiPolygon') {\r\n return new MaskLayer(geojson, options.style(geojson))\r\n }\r\n }\r\n return geometryToLayer(geojson, options)\r\n}\r\n\r\nexport default {\r\n methods: {\r\n processRealtimeGeoJsonLayerOptions (options) {\r\n const leafletOptions = options.leaflet || options\r\n // Alter type as required by the plugin\r\n leafletOptions.type = 'realtime'\r\n // We first need to create an underlying container or setup Id function\r\n const id = _.get(options, 'featureId', _.get(leafletOptions, 'id', '_id'))\r\n if (id) _.set(leafletOptions, 'getFeatureId', (feature) => _.get(feature, 'properties.' + id, _.get(feature, id)))\r\n const container = _.get(leafletOptions, 'container')\r\n // If container given and not already instanciated, do it\r\n if (typeof container === 'string') {\r\n leafletOptions.container = this.createLeafletLayer({ type: container })\r\n }\r\n // Custom update function to ensure dynamic styling works as expected\r\n if (!_.has(leafletOptions, 'updateFeature')) {\r\n leafletOptions.updateFeature = function (feature, oldLayer) {\r\n // A new feature is coming, create it\r\n if (!oldLayer) return\r\n // An existing one is found, simply update styling, properties, etc.\r\n leafletOptions.onEachFeature(feature, oldLayer)\r\n if (oldLayer.setStyle) {\r\n // Some vector layers can be used for points, eg circleMarker,\r\n // in this case we use marker styling instead of lines/polygons styling\r\n if (feature.geometry.type === 'Point') {\r\n // FIXME: updating style in place does not seem to work, so for now we recreate the whole marker\r\n // oldLayer.setStyle(leafletOptions.pointToLayer(feature))\r\n return\r\n } else {\r\n oldLayer.setStyle(leafletOptions.style(feature))\r\n }\r\n }\r\n const oldProperties = _.get(oldLayer, 'feature.properties')\r\n const properties = _.get(feature, 'properties')\r\n if (oldProperties && properties) Object.assign(properties, oldProperties)\r\n if (oldLayer.setIcon) {\r\n // FIXME: updating icon in place requires to recreate it anyway, so for now we recreate the whole marker\r\n // oldLayer.setIcon(_.get(leafletOptions.pointToLayer(feature, oldLayer.getLatLng()), 'options.icon'))\r\n return\r\n }\r\n // And coordinates if not static\r\n const staticGeometry = _.get(leafletOptions, 'staticGeometry', false)\r\n if (staticGeometry) return oldLayer\r\n // The feature is changing its geometry type, recreate it\r\n const oldType = _.get(oldLayer, 'feature.geometry.type')\r\n const type = _.get(feature, 'geometry.type')\r\n if (type !== oldType) return\r\n const coordinates = feature.geometry.coordinates\r\n // FIXME: support others geometry types ?\r\n switch (type) {\r\n case 'Point':\r\n oldLayer.setLatLng(L.GeoJSON.coordsToLatLngs(coordinates))\r\n break\r\n case 'LineString':\r\n case 'MultiLineString':\r\n // Support Gradient Path\r\n if (typeof oldLayer.setData === 'function') oldLayer.setData(feature)\r\n else oldLayer.setLatLngs(L.GeoJSON.coordsToLatLngs(coordinates, type === 'LineString' ? 0 : 1))\r\n break\r\n case 'Polygon':\r\n case 'MultiPolygon':\r\n oldLayer.setLatLngs(L.GeoJSON.coordsToLatLngs(coordinates, type === 'Polygon' ? 1 : 2))\r\n break\r\n }\r\n return oldLayer\r\n }\r\n }\r\n // Check for feature service layers\r\n if (options.service) {\r\n // We perform manual update\r\n _.set(leafletOptions, 'start', false)\r\n // Tell realtime plugin how to update/load data\r\n if (leafletOptions.tiled) {\r\n leafletOptions.removeMissing = false\r\n // Fetching is managed by tiles but even for manual update leaflet realtime require a src\r\n _.set(leafletOptions, 'source', async (successCallback, errorCallback) => {})\r\n // Generate fetch function for tiled feature layer\r\n leafletOptions.featureSource = (baseQuery) => this.getFeatures(_.merge({ baseQuery }, options))\r\n } else {\r\n leafletOptions.removeMissing = !options.probeService\r\n let initialized = !options.probeService // If no probe reference, nothing to be initialized\r\n let lastUpdateTime\r\n _.set(leafletOptions, 'source', async (successCallback, errorCallback) => {\r\n // If the probe location is given by another service use it on initialization\r\n if (!initialized) {\r\n try {\r\n // Use probes as reference\r\n successCallback(await this.getProbeFeatures(options))\r\n initialized = true\r\n } catch (error) {\r\n errorCallback(error)\r\n }\r\n }\r\n try {\r\n // Update only the first time or when required according to data update interval\r\n if (!lastUpdateTime || !this.shouldSkipFeaturesUpdate(lastUpdateTime, options)) {\r\n lastUpdateTime = Time.getCurrentTime().clone()\r\n successCallback(await this.getFeatures(options))\r\n }\r\n } catch (error) {\r\n errorCallback(error)\r\n }\r\n })\r\n }\r\n } else if (options.wfs) {\r\n // Features are fetched from a WFS connection\r\n _.set(leafletOptions, 'start', false)\r\n _.set(leafletOptions, 'source', async (successCallback, errorCallback) => {})\r\n\r\n if (leafletOptions.tiled) {\r\n leafletOptions.removeMissing = false\r\n // Generate fetch function for tiled feature layer\r\n leafletOptions.featureSource = (query) => {\r\n const searchParams = Object.assign({\r\n OUTPUTFORMAT: options.wfs.outputFormat, // request as geojson\r\n SRSNAME: 'EPSG:4326', // result in 4326\r\n BBOX: `${query.south},${query.west},${query.north},${query.east},urn:ogc:def:crs:EPSG::4326` // request bbox\r\n }, options.wfs.searchParams)\r\n return wfs.GetFeature(options.wfs.url, options.wfs.version, options.wfs.layer, searchParams, { xml2json: false })\r\n }\r\n } else {\r\n }\r\n } else if (_.has(leafletOptions, 'sourceTemplate')) {\r\n const sourceCompiler = _.template(_.get(leafletOptions, 'sourceTemplate'))\r\n let lastFetchedSource\r\n // Tell realtime plugin how to update/load data\r\n _.set(leafletOptions, 'source', async (successCallback, errorCallback) => {\r\n try {\r\n const sourceToFetch = sourceCompiler({ time: Time.getCurrentTime() })\r\n if (!lastFetchedSource || (lastFetchedSource !== sourceToFetch)) {\r\n lastFetchedSource = sourceToFetch\r\n successCallback(await fetchGeoJson(sourceToFetch))\r\n }\r\n } catch (error) {\r\n errorCallback(error)\r\n }\r\n })\r\n // We perform manual update\r\n _.set(leafletOptions, 'start', false)\r\n } else if (!_.has(leafletOptions, 'source')) {\r\n _.set(leafletOptions, 'start', false)\r\n // Even for manual update leaflet realtime require a src\r\n _.set(leafletOptions, 'source', async (successCallback, errorCallback) => {})\r\n }\r\n },\r\n async processGeoJsonLayerOptions (options) {\r\n const leafletOptions = options.leaflet || options\r\n const dataSource = _.get(leafletOptions, 'source')\r\n if (_.isNil(dataSource)) {\r\n // Empty valid GeoJson\r\n _.set(leafletOptions, 'source', { type: 'FeatureCollection', features: [] })\r\n } else if (typeof dataSource === 'string') { // URL ? If so load data\r\n let data\r\n // Check for feature service layers\r\n if (options.service) {\r\n data = await this.getFeatures(options)\r\n } else { // Otherwise standard HTTP\r\n data = await fetchGeoJson(dataSource)\r\n }\r\n _.set(leafletOptions, 'source', data)\r\n }\r\n },\r\n processClusterLayerOptions (options) {\r\n const leafletOptions = options.leaflet || options\r\n leafletOptions.container = this.createLeafletLayer(Object.assign({ type: 'markerClusterGroup' }, leafletOptions.cluster))\r\n },\r\n async createLeafletGeoJsonLayer (options) {\r\n const leafletOptions = options.leaflet || options\r\n // Check for valid type\r\n if (leafletOptions.type !== 'geoJson') return\r\n\r\n try {\r\n // If not explicitely disable use defaults for clustering\r\n if (!_.has(leafletOptions, 'cluster') && this.activityOptions.engine.cluster) {\r\n // Merge existing config or create a new one on layer\r\n if (leafletOptions.cluster) Object.assign(leafletOptions.cluster, this.activityOptions.engine.cluster)\r\n else leafletOptions.cluster = Object.assign({}, this.activityOptions.engine.cluster)\r\n }\r\n // Specific case of clustered layer where we first need to create an underlying group\r\n if (leafletOptions.cluster) {\r\n this.processClusterLayerOptions(options)\r\n }\r\n // Specific case of realtime layer\r\n if (leafletOptions.realtime) {\r\n this.processRealtimeGeoJsonLayerOptions(options)\r\n } else {\r\n await this.processGeoJsonLayerOptions(options)\r\n }\r\n // Optimize templating by creating compilers up-front\r\n const layerStyleTemplate = _.get(leafletOptions, 'template')\r\n if (layerStyleTemplate) {\r\n // We allow to template style properties according to feature, because it can be slow you have to specify a subset of properties\r\n leafletOptions.template = layerStyleTemplate.map(property => ({\r\n property, compiler: _.template(_.get(leafletOptions, property))\r\n }))\r\n }\r\n const popupTemplate = _.get(leafletOptions, 'popup.template')\r\n if (popupTemplate) {\r\n leafletOptions.popup.compiler = _.template(popupTemplate)\r\n }\r\n const tooltipTemplate = _.get(leafletOptions, 'tooltip.template')\r\n if (tooltipTemplate) {\r\n leafletOptions.tooltip.compiler = _.template(tooltipTemplate)\r\n }\r\n // Merge generic GeoJson options and layer options\r\n const geoJsonOptions = this.getGeoJsonOptions(options)\r\n Object.keys(geoJsonOptions).forEach(key => {\r\n // If layer provided do not override\r\n if (!_.has(leafletOptions, key)) _.set(leafletOptions, key, _.get(geoJsonOptions, key))\r\n })\r\n leafletOptions.layerStyle = this.convertFromSimpleStyleSpec(leafletOptions)\r\n let layer = this.createLeafletLayer(options)\r\n\r\n // Specific case of realtime layer where the underlying container also need to be added to map\r\n if (leafletOptions.realtime) {\r\n // Build associated tile layer and bind required events\r\n if (leafletOptions.tiled) {\r\n const tiledLayer = new TiledFeatureLayer(leafletOptions)\r\n tiledLayer.setup(this, options)\r\n layer.tiledLayer = tiledLayer\r\n layer.on('add', () => tiledLayer.addTo(this.map))\r\n layer.on('remove', () => tiledLayer.removeFrom(this.map))\r\n }\r\n // Bind event\r\n layer.on('update', (data) => this.$emit('layer-updated', Object.assign({ layer: options, leafletLayer: layer }, data)))\r\n if (leafletOptions.container) layer.once('add', () => leafletOptions.container.addTo(this.map))\r\n // Add FeatureGroup interface so that layer edition works as well\r\n layer.toGeoJSON = () => ({ type: 'FeatureCollection', features: _.values(layer._features) })\r\n layer.clearLayers = () => layer._onNewData(true, { type: 'FeatureCollection', features: [] })\r\n layer.addLayer = (geoJsonLayer) => layer._onNewData(true, geoJsonLayer.toGeoJSON())\r\n // We launch a first update to initialize data\r\n layer.update()\r\n } else {\r\n // Specific case of clustered layer where the group is added instead of the geojson layer\r\n if (leafletOptions.cluster && leafletOptions.container) {\r\n leafletOptions.container.addLayer(layer)\r\n layer = leafletOptions.container\r\n }\r\n }\r\n // Specific case of time dimension layer where we embed the underlying geojson layer\r\n if (leafletOptions.timeDimension) {\r\n layer = this.createLeafletLayer(Object.assign({ type: 'timeDimension.layer.geoJson', source: layer }, leafletOptions.timeDimension))\r\n }\r\n return layer\r\n } catch (error) {\r\n logger.error(error)\r\n return null\r\n }\r\n },\r\n getGeoJsonOptions (options = {}) {\r\n const geojsonOptions = {\r\n onEachFeature: (feature, layer) => {\r\n // Need to restone event listeners as context has changed\r\n unbindLeafletEvents(layer, LeafletEvents.Feature)\r\n // Check for custom onEachFeature function\r\n if (typeof this.onLeafletFeature === 'function') this.onLeafletFeature(feature, layer, options)\r\n // Then for tooltip/popup\r\n // First remove previous popup if any\r\n if (layer.getPopup()) layer.unbindPopup()\r\n const popup = this.generateStyle('popup', feature, layer, options)\r\n if (popup) {\r\n // Because we build a new popup we need to restore previous state\r\n const wasOpen = (layer.getPopup() && layer.isPopupOpen())\r\n layer.bindPopup(popup)\r\n bindLeafletEvents(layer.getPopup(), LeafletEvents.Popup, this, options)\r\n if (wasOpen) layer.openPopup()\r\n }\r\n // First remove previous tooltip if any\r\n if (layer.getTooltip()) layer.unbindTooltip()\r\n const tooltip = this.generateStyle('tooltip', feature, layer, options)\r\n if (tooltip) {\r\n // Because we build a new tooltip we need to restore previous state\r\n const wasOpen = (layer.getTooltip() && layer.isTooltipOpen())\r\n layer.bindTooltip(tooltip)\r\n bindLeafletEvents(layer.getTooltip(), LeafletEvents.Tooltip, this, options)\r\n if (wasOpen) layer.openTooltip()\r\n }\r\n bindLeafletEvents(layer, LeafletEvents.Feature, this, options)\r\n },\r\n style: (feature) => {\r\n return this.generateStyle('featureStyle', feature, options)\r\n },\r\n pointToLayer: (feature, latlng) => {\r\n return this.generateStyle('markerStyle', feature, latlng, options)\r\n }\r\n }\r\n\r\n return geojsonOptions\r\n },\r\n updateLayer (name, geoJson, remove) {\r\n // Retrieve the layer\r\n let layer = this.getLeafletLayerByName(name)\r\n if (!layer) return // Cannot update invisible layer\r\n // Check if clustering on top of a realtime layer, in this case we have a top-level container\r\n let container\r\n if (typeof layer.getLayers === 'function') {\r\n container = layer\r\n layer = container.getLayers().find(layer => layer._container === container)\r\n }\r\n /* By default leaflet-realtime only performs add with manual update\r\n (see https://github.com/perliedman/leaflet-realtime/issues/136)\r\n but we'd like to perform similarly to automated updates\r\n */\r\n if (remove && (typeof layer.remove === 'function')) {\r\n let features = (geoJson.type === 'FeatureCollection' ? geoJson.features : [geoJson])\r\n // Filter features to ensure some have not been already removed\r\n // FIXME: indeed it seems to causes a bug with clustering, see https://github.com/kalisio/kdk/issues/140\r\n features = features.filter(feature => layer.getLayer(layer.options.getFeatureId(feature)))\r\n layer.remove(features)\r\n } else if (typeof layer._onNewData === 'function') {\r\n layer._onNewData(layer.options.removeMissing, geoJson || this.toGeoJson(name))\r\n }\r\n },\r\n onCurrentTimeChangedGeoJsonLayers (time) {\r\n const geoJsonlayers = _.values(this.layers).filter(sift({\r\n 'leaflet.type': 'geoJson',\r\n 'leaflet.realtime': true,\r\n $or: [ // Supported by template URL or time-based features\r\n { 'leaflet.sourceTemplate': { $exists: true } },\r\n { service: { $exists: true }, variables: { $exists: true } }\r\n ],\r\n isVisible: true\r\n }))\r\n geoJsonlayers.forEach(async geoJsonlayer => {\r\n // Retrieve the layer\r\n const layer = this.getLeafletLayerByName(geoJsonlayer.name)\r\n // Then update\r\n if (layer.tiledLayer) layer.tiledLayer.redraw()\r\n else layer.update()\r\n })\r\n }\r\n },\r\n created () {\r\n this.registerLeafletConstructor(this.createLeafletGeoJsonLayer)\r\n this.$events.$on('time-current-time-changed', this.onCurrentTimeChangedGeoJsonLayers)\r\n },\r\n beforeDestroy () {\r\n this.$events.$off('time-current-time-changed', this.onCurrentTimeChangedHeatmapLayers)\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../../../map/client/mixins/map/mixin.geojson-layers.js"],"names":["wfs","geometryToLayer","L","GeoJSON","geojson","options","geometry","properties","geodesic","type","Geodesic","coordsToLatLngs","coordinates","Object","assign","steps","style","layer","fill","createCircle","coordsToLatLng","radius","gradient","GradientPath","mask","MaskLayer","methods","processRealtimeGeoJsonLayerOptions","leafletOptions","leaflet","id","_","get","set","feature","container","createLeafletLayer","has","updateFeature","oldLayer","onEachFeature","setStyle","oldProperties","forOwn","value","key","setIcon","staticGeometry","oldType","setLatLng","setData","setLatLngs","service","tiled","removeMissing","successCallback","errorCallback","featureSource","baseQuery","getFeatures","merge","probeService","initialized","lastUpdateTime","getProbeFeatures","error","shouldSkipFeaturesUpdate","Time","getCurrentTime","clone","query","searchParams","OUTPUTFORMAT","outputFormat","SRSNAME","BBOX","south","west","north","east","GetFeature","url","version","xml2json","sourceCompiler","template","lastFetchedSource","sourceToFetch","time","processGeoJsonLayerOptions","dataSource","isNil","features","data","processClusterLayerOptions","cluster","createLeafletGeoJsonLayer","activityOptions","engine","realtime","layerStyleTemplate","map","property","compiler","popupTemplate","popup","tooltipTemplate","tooltip","geoJsonOptions","getGeoJsonOptions","keys","forEach","layerStyle","convertFromSimpleStyleSpec","tiledLayer","TiledFeatureLayer","setup","on","addTo","removeFrom","$emit","leafletLayer","once","toGeoJSON","values","_features","clearLayers","_onNewData","addLayer","geoJsonLayer","update","timeDimension","source","logger","geojsonOptions","LeafletEvents","Feature","onLeafletFeature","getPopup","unbindPopup","generateStyle","wasOpen","isPopupOpen","bindPopup","Popup","openPopup","getTooltip","unbindTooltip","isTooltipOpen","bindTooltip","Tooltip","openTooltip","pointToLayer","latlng","updateLayer","name","geoJson","remove","getLeafletLayerByName","getLayers","find","_container","filter","getLayer","getFeatureId","toGeoJson","onCurrentTimeChangedGeoJsonLayers","geoJsonlayers","layers","$or","$exists","variables","isVisible","geoJsonlayer","redraw","created","registerLeafletConstructor","$events","$on","beforeDestroy","$off","onCurrentTimeChangedHeatmapLayers"],"mappings":";;;;;;AAAA;;;;AACA;;;;AACA;;;;AACA;;;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;IAAYA,G;;;;;;;;AAEZ;AACA,MAAMC,kBAAkBC,kBAAEC,OAAF,CAAUF,eAAlC;AACAC,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,EAAED,SAAS,IAAX,EAAzC,EAFG,CAHiD;AAOtDE,mBAAW;AAP2C,OAAL,CAA7B,CAAtB;AASAL,oBAAcxD,OAAd;AAAA,sCAAsB,WAAM8D,YAAN,EAAsB;AAC1C;AACA,gBAAM5J,QAAQ,OAAK6I,qBAAL,CAA2Be,aAAalB,IAAxC,CAAd;AACA;AACA,cAAI1I,MAAMiG,UAAV,EAAsBjG,MAAMiG,UAAN,CAAiB4D,MAAjB,GAAtB,KACK7J,MAAMiH,MAAN;AACN,SAND;;AAAA;AAAA;AAAA;AAAA;AAOD;AA9UM,GADI;AAiVb6C,YAAW;AACT,SAAKC,0BAAL,CAAgC,KAAKhF,yBAArC;AACA,SAAKiF,OAAL,CAAaC,GAAb,CAAiB,2BAAjB,EAA8C,KAAKZ,iCAAnD;AACD,GApVY;AAqVba,kBAAiB;AACf,SAAKF,OAAL,CAAaG,IAAb,CAAkB,2BAAlB,EAA+C,KAAKC,iCAApD;AACD;AAvVY,C","file":"mixin.geojson-layers.js","sourcesContent":["import L from 'leaflet'\r\nimport _ from 'lodash'\r\nimport sift from 'sift'\r\nimport logger from 'loglevel'\r\nimport 'leaflet-realtime'\r\nimport { Time } from '../../../../core/client/time'\r\nimport { GradientPath } from '../../leaflet/GradientPath'\r\nimport { MaskLayer } from '../../leaflet/MaskLayer'\r\nimport { TiledFeatureLayer } from '../../leaflet/TiledFeatureLayer'\r\nimport { fetchGeoJson, LeafletEvents, bindLeafletEvents, unbindLeafletEvents } from '../../utils'\r\nimport * as wfs from '../../../common/wfs-utils'\r\n\r\n// Override default Leaflet GeoJson utility to manage some specific use cases\r\nconst geometryToLayer = L.GeoJSON.geometryToLayer\r\nL.GeoJSON.geometryToLayer = function (geojson, options) {\r\n const geometry = geojson.geometry\r\n const properties = geojson.properties\r\n if (geometry && properties && properties.geodesic) {\r\n if (geometry.type === 'LineString') {\r\n return new L.Geodesic([L.GeoJSON.coordsToLatLngs(geometry.coordinates, 0)],\r\n Object.assign({ steps: 100 }, options.style(geojson)))\r\n } else if (geometry.type === 'Point') {\r\n const layer = new L.Geodesic([], Object.assign({ fill: true, steps: 360 }, options.style(geojson)))\r\n layer.createCircle(L.GeoJSON.coordsToLatLng(geometry.coordinates), properties.radius)\r\n return layer\r\n }\r\n }\r\n if (geometry && properties && properties.gradient) {\r\n if (geometry.type === 'LineString') {\r\n return new GradientPath(geojson, options.style(geojson))\r\n }\r\n }\r\n if (geometry && properties && properties.mask) {\r\n if (geometry.type === 'Polygon' || geometry.type === 'MultiPolygon') {\r\n return new MaskLayer(geojson, options.style(geojson))\r\n }\r\n }\r\n return geometryToLayer(geojson, options)\r\n}\r\n\r\nexport default {\r\n methods: {\r\n processRealtimeGeoJsonLayerOptions (options) {\r\n const leafletOptions = options.leaflet || options\r\n // Alter type as required by the plugin\r\n leafletOptions.type = 'realtime'\r\n // We first need to create an underlying container or setup Id function\r\n const id = _.get(options, 'featureId', _.get(leafletOptions, 'id', '_id'))\r\n if (id) _.set(leafletOptions, 'getFeatureId', (feature) => _.get(feature, 'properties.' + id, _.get(feature, id)))\r\n const container = _.get(leafletOptions, 'container')\r\n // If container given and not already instanciated, do it\r\n if (typeof container === 'string') {\r\n leafletOptions.container = this.createLeafletLayer({ type: container })\r\n }\r\n // Custom update function to ensure dynamic styling works as expected\r\n if (!_.has(leafletOptions, 'updateFeature')) {\r\n leafletOptions.updateFeature = function (feature, oldLayer) {\r\n // A new feature is coming, create it\r\n if (!oldLayer) return\r\n // An existing one is found, simply update styling, properties, etc.\r\n leafletOptions.onEachFeature(feature, oldLayer)\r\n if (oldLayer.setStyle) {\r\n // Some vector layers can be used for points, eg circleMarker,\r\n // in this case we use marker styling instead of lines/polygons styling\r\n if (feature.geometry.type === 'Point') {\r\n // FIXME: updating style in place does not seem to work, so for now we recreate the whole marker\r\n // oldLayer.setStyle(leafletOptions.pointToLayer(feature))\r\n return\r\n } else {\r\n oldLayer.setStyle(leafletOptions.style(feature))\r\n }\r\n }\r\n const oldProperties = _.get(oldLayer, 'feature.properties')\r\n const properties = _.get(feature, 'properties')\r\n // Keep track of old properties\r\n if (oldProperties && properties) {\r\n _.forOwn(oldProperties, (value, key) => {\r\n if (!_.has(properties, key)) _.set(properties, key, value)\r\n })\r\n }\r\n if (oldLayer.setIcon) {\r\n // FIXME: updating icon in place requires to recreate it anyway, so for now we recreate the whole marker\r\n // oldLayer.setIcon(_.get(leafletOptions.pointToLayer(feature, oldLayer.getLatLng()), 'options.icon'))\r\n return\r\n }\r\n // And coordinates if not static\r\n const staticGeometry = _.get(leafletOptions, 'staticGeometry', false)\r\n if (staticGeometry) return oldLayer\r\n // The feature is changing its geometry type, recreate it\r\n const oldType = _.get(oldLayer, 'feature.geometry.type')\r\n const type = _.get(feature, 'geometry.type')\r\n if (type !== oldType) return\r\n const coordinates = feature.geometry.coordinates\r\n // FIXME: support others geometry types ?\r\n switch (type) {\r\n case 'Point':\r\n oldLayer.setLatLng(L.GeoJSON.coordsToLatLngs(coordinates))\r\n break\r\n case 'LineString':\r\n case 'MultiLineString':\r\n // Support Gradient Path\r\n if (typeof oldLayer.setData === 'function') oldLayer.setData(feature)\r\n else oldLayer.setLatLngs(L.GeoJSON.coordsToLatLngs(coordinates, type === 'LineString' ? 0 : 1))\r\n break\r\n case 'Polygon':\r\n case 'MultiPolygon':\r\n oldLayer.setLatLngs(L.GeoJSON.coordsToLatLngs(coordinates, type === 'Polygon' ? 1 : 2))\r\n break\r\n }\r\n return oldLayer\r\n }\r\n }\r\n // Check for feature service layers\r\n if (options.service) {\r\n // We perform manual update\r\n _.set(leafletOptions, 'start', false)\r\n // Tell realtime plugin how to update/load data\r\n if (leafletOptions.tiled) {\r\n leafletOptions.removeMissing = false\r\n // Fetching is managed by tiles but even for manual update leaflet realtime require a src\r\n _.set(leafletOptions, 'source', async (successCallback, errorCallback) => {})\r\n // Generate fetch function for tiled feature layer\r\n leafletOptions.featureSource = (baseQuery) => this.getFeatures(_.merge({ baseQuery }, options))\r\n } else {\r\n leafletOptions.removeMissing = !options.probeService\r\n let initialized = !options.probeService // If no probe reference, nothing to be initialized\r\n let lastUpdateTime\r\n _.set(leafletOptions, 'source', async (successCallback, errorCallback) => {\r\n // If the probe location is given by another service use it on initialization\r\n if (!initialized) {\r\n try {\r\n // Use probes as reference\r\n successCallback(await this.getProbeFeatures(options))\r\n initialized = true\r\n } catch (error) {\r\n errorCallback(error)\r\n }\r\n }\r\n try {\r\n // Update only the first time or when required according to data update interval\r\n if (!lastUpdateTime || !this.shouldSkipFeaturesUpdate(lastUpdateTime, options)) {\r\n lastUpdateTime = Time.getCurrentTime().clone()\r\n successCallback(await this.getFeatures(options))\r\n }\r\n } catch (error) {\r\n errorCallback(error)\r\n }\r\n })\r\n }\r\n } else if (options.wfs) {\r\n // Features are fetched from a WFS connection\r\n _.set(leafletOptions, 'start', false)\r\n _.set(leafletOptions, 'source', async (successCallback, errorCallback) => {})\r\n\r\n if (leafletOptions.tiled) {\r\n leafletOptions.removeMissing = false\r\n // Generate fetch function for tiled feature layer\r\n leafletOptions.featureSource = (query) => {\r\n const searchParams = Object.assign({\r\n OUTPUTFORMAT: options.wfs.outputFormat, // request as geojson\r\n SRSNAME: 'EPSG:4326', // result in 4326\r\n BBOX: `${query.south},${query.west},${query.north},${query.east},urn:ogc:def:crs:EPSG::4326` // request bbox\r\n }, options.wfs.searchParams)\r\n return wfs.GetFeature(options.wfs.url, options.wfs.version, options.wfs.layer, searchParams, { xml2json: false })\r\n }\r\n } else {\r\n }\r\n } else if (_.has(leafletOptions, 'sourceTemplate')) {\r\n const sourceCompiler = _.template(_.get(leafletOptions, 'sourceTemplate'))\r\n let lastFetchedSource\r\n // Tell realtime plugin how to update/load data\r\n _.set(leafletOptions, 'source', async (successCallback, errorCallback) => {\r\n try {\r\n const sourceToFetch = sourceCompiler({ time: Time.getCurrentTime() })\r\n if (!lastFetchedSource || (lastFetchedSource !== sourceToFetch)) {\r\n lastFetchedSource = sourceToFetch\r\n successCallback(await fetchGeoJson(sourceToFetch))\r\n }\r\n } catch (error) {\r\n errorCallback(error)\r\n }\r\n })\r\n // We perform manual update\r\n _.set(leafletOptions, 'start', false)\r\n } else if (!_.has(leafletOptions, 'source')) {\r\n _.set(leafletOptions, 'start', false)\r\n // Even for manual update leaflet realtime require a src\r\n _.set(leafletOptions, 'source', async (successCallback, errorCallback) => {})\r\n }\r\n },\r\n async processGeoJsonLayerOptions (options) {\r\n const leafletOptions = options.leaflet || options\r\n const dataSource = _.get(leafletOptions, 'source')\r\n if (_.isNil(dataSource)) {\r\n // Empty valid GeoJson\r\n _.set(leafletOptions, 'source', { type: 'FeatureCollection', features: [] })\r\n } else if (typeof dataSource === 'string') { // URL ? If so load data\r\n let data\r\n // Check for feature service layers\r\n if (options.service) {\r\n data = await this.getFeatures(options)\r\n } else { // Otherwise standard HTTP\r\n data = await fetchGeoJson(dataSource)\r\n }\r\n _.set(leafletOptions, 'source', data)\r\n }\r\n },\r\n processClusterLayerOptions (options) {\r\n const leafletOptions = options.leaflet || options\r\n leafletOptions.container = this.createLeafletLayer(Object.assign({ type: 'markerClusterGroup' }, leafletOptions.cluster))\r\n },\r\n async createLeafletGeoJsonLayer (options) {\r\n const leafletOptions = options.leaflet || options\r\n // Check for valid type\r\n if (leafletOptions.type !== 'geoJson') return\r\n\r\n try {\r\n // If not explicitely disable use defaults for clustering\r\n if (!_.has(leafletOptions, 'cluster') && this.activityOptions.engine.cluster) {\r\n // Merge existing config or create a new one on layer\r\n if (leafletOptions.cluster) Object.assign(leafletOptions.cluster, this.activityOptions.engine.cluster)\r\n else leafletOptions.cluster = Object.assign({}, this.activityOptions.engine.cluster)\r\n }\r\n // Specific case of clustered layer where we first need to create an underlying group\r\n if (leafletOptions.cluster) {\r\n this.processClusterLayerOptions(options)\r\n }\r\n // Specific case of realtime layer\r\n if (leafletOptions.realtime) {\r\n this.processRealtimeGeoJsonLayerOptions(options)\r\n } else {\r\n await this.processGeoJsonLayerOptions(options)\r\n }\r\n // Optimize templating by creating compilers up-front\r\n const layerStyleTemplate = _.get(leafletOptions, 'template')\r\n if (layerStyleTemplate) {\r\n // We allow to template style properties according to feature, because it can be slow you have to specify a subset of properties\r\n leafletOptions.template = layerStyleTemplate.map(property => ({\r\n property, compiler: _.template(_.get(leafletOptions, property))\r\n }))\r\n }\r\n const popupTemplate = _.get(leafletOptions, 'popup.template')\r\n if (popupTemplate) {\r\n leafletOptions.popup.compiler = _.template(popupTemplate)\r\n }\r\n const tooltipTemplate = _.get(leafletOptions, 'tooltip.template')\r\n if (tooltipTemplate) {\r\n leafletOptions.tooltip.compiler = _.template(tooltipTemplate)\r\n }\r\n // Merge generic GeoJson options and layer options\r\n const geoJsonOptions = this.getGeoJsonOptions(options)\r\n Object.keys(geoJsonOptions).forEach(key => {\r\n // If layer provided do not override\r\n if (!_.has(leafletOptions, key)) _.set(leafletOptions, key, _.get(geoJsonOptions, key))\r\n })\r\n leafletOptions.layerStyle = this.convertFromSimpleStyleSpec(leafletOptions)\r\n let layer = this.createLeafletLayer(options)\r\n\r\n // Specific case of realtime layer where the underlying container also need to be added to map\r\n if (leafletOptions.realtime) {\r\n // Build associated tile layer and bind required events\r\n if (leafletOptions.tiled) {\r\n const tiledLayer = new TiledFeatureLayer(leafletOptions)\r\n tiledLayer.setup(this, options)\r\n layer.tiledLayer = tiledLayer\r\n layer.on('add', () => tiledLayer.addTo(this.map))\r\n layer.on('remove', () => tiledLayer.removeFrom(this.map))\r\n }\r\n // Bind event\r\n layer.on('update', (data) => this.$emit('layer-updated', Object.assign({ layer: options, leafletLayer: layer }, data)))\r\n if (leafletOptions.container) layer.once('add', () => leafletOptions.container.addTo(this.map))\r\n // Add FeatureGroup interface so that layer edition works as well\r\n layer.toGeoJSON = () => ({ type: 'FeatureCollection', features: _.values(layer._features) })\r\n layer.clearLayers = () => layer._onNewData(true, { type: 'FeatureCollection', features: [] })\r\n layer.addLayer = (geoJsonLayer) => layer._onNewData(true, geoJsonLayer.toGeoJSON())\r\n // We launch a first update to initialize data\r\n layer.update()\r\n } else {\r\n // Specific case of clustered layer where the group is added instead of the geojson layer\r\n if (leafletOptions.cluster && leafletOptions.container) {\r\n leafletOptions.container.addLayer(layer)\r\n layer = leafletOptions.container\r\n }\r\n }\r\n // Specific case of time dimension layer where we embed the underlying geojson layer\r\n if (leafletOptions.timeDimension) {\r\n layer = this.createLeafletLayer(Object.assign({ type: 'timeDimension.layer.geoJson', source: layer }, leafletOptions.timeDimension))\r\n }\r\n return layer\r\n } catch (error) {\r\n logger.error(error)\r\n return null\r\n }\r\n },\r\n getGeoJsonOptions (options = {}) {\r\n const geojsonOptions = {\r\n onEachFeature: (feature, layer) => {\r\n // Need to restone event listeners as context has changed\r\n unbindLeafletEvents(layer, LeafletEvents.Feature)\r\n // Check for custom onEachFeature function\r\n if (typeof this.onLeafletFeature === 'function') this.onLeafletFeature(feature, layer, options)\r\n // Then for tooltip/popup\r\n // First remove previous popup if any\r\n if (layer.getPopup()) layer.unbindPopup()\r\n const popup = this.generateStyle('popup', feature, layer, options)\r\n if (popup) {\r\n // Because we build a new popup we need to restore previous state\r\n const wasOpen = (layer.getPopup() && layer.isPopupOpen())\r\n layer.bindPopup(popup)\r\n bindLeafletEvents(layer.getPopup(), LeafletEvents.Popup, this, options)\r\n if (wasOpen) layer.openPopup()\r\n }\r\n // First remove previous tooltip if any\r\n if (layer.getTooltip()) layer.unbindTooltip()\r\n const tooltip = this.generateStyle('tooltip', feature, layer, options)\r\n if (tooltip) {\r\n // Because we build a new tooltip we need to restore previous state\r\n const wasOpen = (layer.getTooltip() && layer.isTooltipOpen())\r\n layer.bindTooltip(tooltip)\r\n bindLeafletEvents(layer.getTooltip(), LeafletEvents.Tooltip, this, options)\r\n if (wasOpen) layer.openTooltip()\r\n }\r\n bindLeafletEvents(layer, LeafletEvents.Feature, this, options)\r\n },\r\n style: (feature) => {\r\n return this.generateStyle('featureStyle', feature, options)\r\n },\r\n pointToLayer: (feature, latlng) => {\r\n return this.generateStyle('markerStyle', feature, latlng, options)\r\n }\r\n }\r\n\r\n return geojsonOptions\r\n },\r\n updateLayer (name, geoJson, remove) {\r\n // Retrieve the layer\r\n let layer = this.getLeafletLayerByName(name)\r\n if (!layer) return // Cannot update invisible layer\r\n // Check if clustering on top of a realtime layer, in this case we have a top-level container\r\n let container\r\n if (typeof layer.getLayers === 'function') {\r\n container = layer\r\n layer = container.getLayers().find(layer => layer._container === container)\r\n }\r\n /* By default leaflet-realtime only performs add with manual update\r\n (see https://github.com/perliedman/leaflet-realtime/issues/136)\r\n but we'd like to perform similarly to automated updates\r\n */\r\n if (remove && (typeof layer.remove === 'function')) {\r\n let features = (geoJson.type === 'FeatureCollection' ? geoJson.features : [geoJson])\r\n // Filter features to ensure some have not been already removed\r\n // FIXME: indeed it seems to causes a bug with clustering, see https://github.com/kalisio/kdk/issues/140\r\n features = features.filter(feature => layer.getLayer(layer.options.getFeatureId(feature)))\r\n layer.remove(features)\r\n } else if (typeof layer._onNewData === 'function') {\r\n layer._onNewData(layer.options.removeMissing, geoJson || this.toGeoJson(name))\r\n }\r\n },\r\n onCurrentTimeChangedGeoJsonLayers (time) {\r\n const geoJsonlayers = _.values(this.layers).filter(sift({\r\n 'leaflet.type': 'geoJson',\r\n 'leaflet.realtime': true,\r\n $or: [ // Supported by template URL or time-based features\r\n { 'leaflet.sourceTemplate': { $exists: true } },\r\n { service: { $exists: true }, variables: { $exists: true } }\r\n ],\r\n isVisible: true\r\n }))\r\n geoJsonlayers.forEach(async geoJsonlayer => {\r\n // Retrieve the layer\r\n const layer = this.getLeafletLayerByName(geoJsonlayer.name)\r\n // Then update\r\n if (layer.tiledLayer) layer.tiledLayer.redraw()\r\n else layer.update()\r\n })\r\n }\r\n },\r\n created () {\r\n this.registerLeafletConstructor(this.createLeafletGeoJsonLayer)\r\n this.$events.$on('time-current-time-changed', this.onCurrentTimeChangedGeoJsonLayers)\r\n },\r\n beforeDestroy () {\r\n this.$events.$off('time-current-time-changed', this.onCurrentTimeChangedHeatmapLayers)\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../map/client/readers/reader.geojson.js"],"names":["readGEOJSON","file","options","logger","debug","name","Promise","resolve","reject","reader","FileReader","onloadend","content","result","JSON","parse","error","Error","i18next","t","errors","messages","geojsonhint","hint","_","filter","message","get","length","onerror","readAsText"],"mappings":";;;;;QAKgBA,W,GAAAA,W;;AALhB;;;;AACA;;;;AACA;;;;AACA;;;;;;AAEO,SAASA,WAAT,CAAsBC,IAAtB,EAA4BC,OAA5B,EAAqC;AAC1CC,qBAAOC,KAAP,CAAc,wBAAuBH,KAAKI,IAAK,EAA/C;AACA,SAAO,IAAIC,OAAJ,CAAY,CAACC,OAAD,EAAUC,MAAV,KAAqB;AACtC,UAAMC,SAAS,IAAIC,UAAJ,EAAf;AACAD,WAAOE,SAAP,GAAmB,MAAM;AACvB,UAAIC,UAAUH,OAAOI,MAArB;AACA,UAAI;AACFD,kBAAUE,KAAKC,KAAL,CAAWH,OAAX,CAAV;AACD,OAFD,CAEE,OAAOI,KAAP,EAAc;AACdR,eAAO,IAAIS,KAAJ,CAAUC,kBAAQC,CAAR,CAAU,0BAAV,EAAsC,EAAElB,MAAMA,KAAKI,IAAb,EAAtC,CAAV,EAAsE,EAAEe,QAAQJ,KAAV,EAAtE,CAAP;AACA;AACD;AACD;AACA,YAAMK,WAAWC,sBAAYC,IAAZ,CAAiBX,OAAjB,EAA0BV,OAA1B,CAAjB;AACA;AACA,YAAMkB,SAASI,iBAAEC,MAAF,CAASJ,QAAT,EAAmBK,WAAW;AAC3C,eAAOF,iBAAEG,GAAF,CAAMD,OAAN,EAAe,OAAf,MAA4B,SAAnC;AACD,OAFc,CAAf;AAGA,UAAIN,OAAOQ,MAAP,GAAgB,CAApB,EAAuB;AACrBzB,2BAAOC,KAAP,CAAagB,MAAb;AACAZ,eAAO,IAAIS,KAAJ,CAAUC,kBAAQC,CAAR,CAAU,6BAAV,EAAyC,EAAElB,MAAMA,KAAKI,IAAb,EAAzC,CAAV,EAAyE,EAAEe,MAAF,EAAzE,CAAP;AACA;AACD;AACD;AACAb,cAAQK,OAAR;AACD,KArBD;AAsBAH,WAAOoB,OAAP,GAAkBb,KAAD,IAAW;AAC1Bb,yBAAOC,KAAP,CAAaY,KAAb;AACAR,aAAO,IAAIS,KAAJ,CAAUC,kBAAQC,CAAR,CAAU,yBAAV,EAAqC,EAAElB,MAAMA,KAAKI,IAAb,EAArC,CAAV,EAAqE,EAAEe,QAAQJ,KAAV,EAArE,CAAP;AACD,KAHD;AAIAP,WAAOqB,UAAP,CAAkB7B,IAAlB;AACD,GA7BM,CAAP;AA8BD","file":"reader.geojson.js","sourcesContent":["import logger from 'loglevel'\r\nimport _ from 'lodash'\r\nimport i18next from 'i18next'\r\nimport geojsonhint from '@mapbox/geojsonhint'\r\n\r\nexport function readGEOJSON (file, options) {\r\n logger.debug(`reading GeoJSON file ${file.name}`)\r\n return new Promise((resolve, reject) => {\r\n const reader = new FileReader()\r\n reader.onloadend = () => {\r\n let content = reader.result\r\n try {\r\n content = JSON.parse(content)\r\n } catch (error) {\r\n reject(new Error(i18next.t('errors.INVALID_JSON_FILE', { file: file.name }), { errors: error }))\r\n return\r\n }\r\n // lint the geosjon file\r\n const messages = geojsonhint.hint(content, options)\r\n // filter the message according the level to find the errors\r\n const errors = _.filter(messages, message => {\r\n return _.get(message, 'level') !== 'message'\r\n })\r\n if (errors.length > 0) {\r\n logger.debug(errors)\r\n reject(new Error(i18next.t('errors.INVALID_GEOJSON_FILE', { file: file.name }), { errors }))\r\n return\r\n }\r\n // the geosjon file is correct\r\n resolve(content)\r\n }\r\n reader.onerror = (error) => {\r\n logger.debug(error)\r\n reject(new Error(i18next.t('errors.CANNOT_READ_FILE', { file: file.name }), { errors: error }))\n }\r\n reader.readAsText(file)\r\n })\r\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../../map/client/readers/reader.geojson.js"],"names":["readGEOJSON","file","options","logger","debug","name","Promise","resolve","reject","reader","FileReader","onloadend","content","result","JSON","parse","error","Error","i18next","t","errors","messages","geojsonhint","hint","_","filter","message","get","length","onerror","readAsText"],"mappings":";;;;;QAKgBA,W,GAAAA,W;;AALhB;;;;AACA;;;;AACA;;;;AACA;;;;;;AAEO,SAASA,WAAT,CAAsBC,IAAtB,EAA4BC,OAA5B,EAAqC;AAC1CC,qBAAOC,KAAP,CAAc,wBAAuBH,KAAKI,IAAK,EAA/C;AACA,SAAO,IAAIC,OAAJ,CAAY,CAACC,OAAD,EAAUC,MAAV,KAAqB;AACtC,UAAMC,SAAS,IAAIC,UAAJ,EAAf;AACAD,WAAOE,SAAP,GAAmB,MAAM;AACvB,UAAIC,UAAUH,OAAOI,MAArB;AACA,UAAI;AACFD,kBAAUE,KAAKC,KAAL,CAAWH,OAAX,CAAV;AACD,OAFD,CAEE,OAAOI,KAAP,EAAc;AACdR,eAAO,IAAIS,KAAJ,CAAUC,kBAAQC,CAAR,CAAU,0BAAV,EAAsC,EAAElB,MAAMA,KAAKI,IAAb,EAAtC,CAAV,EAAsE,EAAEe,QAAQJ,KAAV,EAAtE,CAAP;AACA;AACD;AACD;AACA,YAAMK,WAAWC,sBAAYC,IAAZ,CAAiBX,OAAjB,EAA0BV,OAA1B,CAAjB;AACA;AACA,YAAMkB,SAASI,iBAAEC,MAAF,CAASJ,QAAT,EAAmBK,WAAW;AAC3C,eAAOF,iBAAEG,GAAF,CAAMD,OAAN,EAAe,OAAf,MAA4B,SAAnC;AACD,OAFc,CAAf;AAGA,UAAIN,OAAOQ,MAAP,GAAgB,CAApB,EAAuB;AACrBzB,2BAAOC,KAAP,CAAagB,MAAb;AACAZ,eAAO,IAAIS,KAAJ,CAAUC,kBAAQC,CAAR,CAAU,6BAAV,EAAyC,EAAElB,MAAMA,KAAKI,IAAb,EAAzC,CAAV,EAAyE,EAAEe,MAAF,EAAzE,CAAP;AACA;AACD;AACD;AACAb,cAAQK,OAAR;AACD,KArBD;AAsBAH,WAAOoB,OAAP,GAAkBb,KAAD,IAAW;AAC1Bb,yBAAOC,KAAP,CAAaY,KAAb;AACAR,aAAO,IAAIS,KAAJ,CAAUC,kBAAQC,CAAR,CAAU,yBAAV,EAAqC,EAAElB,MAAMA,KAAKI,IAAb,EAArC,CAAV,EAAqE,EAAEe,QAAQJ,KAAV,EAArE,CAAP;AACD,KAHD;AAIAP,WAAOqB,UAAP,CAAkB7B,IAAlB;AACD,GA7BM,CAAP;AA8BD","file":"reader.geojson.js","sourcesContent":["import logger from 'loglevel'\r\nimport _ from 'lodash'\r\nimport i18next from 'i18next'\r\nimport geojsonhint from '@mapbox/geojsonhint'\r\n\r\nexport function readGEOJSON (file, options) {\r\n logger.debug(`reading GeoJSON file ${file.name}`)\r\n return new Promise((resolve, reject) => {\r\n const reader = new FileReader()\r\n reader.onloadend = () => {\r\n let content = reader.result\r\n try {\r\n content = JSON.parse(content)\r\n } catch (error) {\r\n reject(new Error(i18next.t('errors.INVALID_JSON_FILE', { file: file.name }), { errors: error }))\r\n return\r\n }\r\n // lint the geosjon file\r\n const messages = geojsonhint.hint(content, options)\r\n // filter the message according the level to find the errors\r\n const errors = _.filter(messages, message => {\r\n return _.get(message, 'level') !== 'message'\r\n })\r\n if (errors.length > 0) {\r\n logger.debug(errors)\r\n reject(new Error(i18next.t('errors.INVALID_GEOJSON_FILE', { file: file.name }), { errors }))\r\n return\r\n }\r\n // the geosjon file is correct\r\n resolve(content)\r\n }\r\n reader.onerror = (error) => {\r\n logger.debug(error)\r\n reject(new Error(i18next.t('errors.CANNOT_READ_FILE', { file: file.name }), { errors: error }))\r\n }\r\n reader.readAsText(file)\r\n })\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../map/client/readers/reader.gpx.js"],"names":["readGPX","file","options","Promise","resolve","reject","reader","FileReader","onloadend","content","result","DOMParser","parseFromString","error","logger","debug","Error","i18next","t","name","errors","onerror","readAsText"],"mappings":";;;;;QAIgBA,O,GAAAA,O;;AAJhB;;;;AACA;;;;AACA;;;;AAEO,SAASA,OAAT,CAAkBC,IAAlB,EAAwBC,OAAxB,EAAiC;AACtC,SAAO,IAAIC,OAAJ,CAAY,CAACC,OAAD,EAAUC,MAAV,KAAqB;AACtC,UAAMC,SAAS,IAAIC,UAAJ,EAAf;AACAD,WAAOE,SAAP,GAAmB,MAAM;AACvB,UAAIC,UAAUH,OAAOI,MAArB;AACA,UAAI;AACFD,kBAAU,oBAAI,IAAIE,SAAJ,GAAgBC,eAAhB,CAAgCH,OAAhC,EAAyC,UAAzC,CAAJ,CAAV;AACD,OAFD,CAEE,OAAOI,KAAP,EAAc;AACdC,2BAAOC,KAAP,CAAaF,KAAb;AACAR,eAAO,IAAIW,KAAJ,CAAUC,kBAAQC,CAAR,CAAU,yBAAV,EAAqC,EAAEjB,MAAMA,KAAKkB,IAAb,EAArC,CAAV,EAAqE,EAAEC,QAAQP,KAAV,EAArE,CAAP;AACA;AACD;AACDT,cAAQK,OAAR;AACD,KAVD;AAWAH,WAAOe,OAAP,GAAkBR,KAAD,IAAW;AAC1BC,yBAAOC,KAAP,CAAaF,KAAb;AACAR,aAAO,IAAIW,KAAJ,CAAUC,kBAAQC,CAAR,CAAU,yBAAV,EAAqC,EAAEjB,MAAMA,KAAKkB,IAAb,EAArC,CAAV,EAAqE,EAAEC,QAAQP,KAAV,EAArE,CAAP;AACD,KAHD;AAIAP,WAAOgB,UAAP,CAAkBrB,IAAlB;AACD,GAlBM,CAAP;AAmBD","file":"reader.gpx.js","sourcesContent":["import logger from 'loglevel'\r\nimport i18next from 'i18next'\r\nimport { gpx } from '@tmcw/togeojson'\r\n\r\nexport function readGPX (file, options) {\r\n return new Promise((resolve, reject) => {\r\n const reader = new FileReader()\r\n reader.onloadend = () => {\r\n let content = reader.result\r\n try {\r\n content = gpx(new DOMParser().parseFromString(content, 'text/xml'))\r\n } catch (error) {\r\n logger.debug(error)\r\n reject(new Error(i18next.t('errors.INVALID_GPX_FILE', { file: file.name }), { errors: error }))\r\n return\r\n }\r\n resolve(content)\r\n }\r\n reader.onerror = (error) => {\r\n logger.debug(error)\r\n reject(new Error(i18next.t('errors.CANNOT_READ_FILE', { file: file.name }), { errors: error }))\n }\r\n reader.readAsText(file)\r\n })\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../../map/client/readers/reader.gpx.js"],"names":["readGPX","file","options","Promise","resolve","reject","reader","FileReader","onloadend","content","result","DOMParser","parseFromString","error","logger","debug","Error","i18next","t","name","errors","onerror","readAsText"],"mappings":";;;;;QAIgBA,O,GAAAA,O;;AAJhB;;;;AACA;;;;AACA;;;;AAEO,SAASA,OAAT,CAAkBC,IAAlB,EAAwBC,OAAxB,EAAiC;AACtC,SAAO,IAAIC,OAAJ,CAAY,CAACC,OAAD,EAAUC,MAAV,KAAqB;AACtC,UAAMC,SAAS,IAAIC,UAAJ,EAAf;AACAD,WAAOE,SAAP,GAAmB,MAAM;AACvB,UAAIC,UAAUH,OAAOI,MAArB;AACA,UAAI;AACFD,kBAAU,oBAAI,IAAIE,SAAJ,GAAgBC,eAAhB,CAAgCH,OAAhC,EAAyC,UAAzC,CAAJ,CAAV;AACD,OAFD,CAEE,OAAOI,KAAP,EAAc;AACdC,2BAAOC,KAAP,CAAaF,KAAb;AACAR,eAAO,IAAIW,KAAJ,CAAUC,kBAAQC,CAAR,CAAU,yBAAV,EAAqC,EAAEjB,MAAMA,KAAKkB,IAAb,EAArC,CAAV,EAAqE,EAAEC,QAAQP,KAAV,EAArE,CAAP;AACA;AACD;AACDT,cAAQK,OAAR;AACD,KAVD;AAWAH,WAAOe,OAAP,GAAkBR,KAAD,IAAW;AAC1BC,yBAAOC,KAAP,CAAaF,KAAb;AACAR,aAAO,IAAIW,KAAJ,CAAUC,kBAAQC,CAAR,CAAU,yBAAV,EAAqC,EAAEjB,MAAMA,KAAKkB,IAAb,EAArC,CAAV,EAAqE,EAAEC,QAAQP,KAAV,EAArE,CAAP;AACD,KAHD;AAIAP,WAAOgB,UAAP,CAAkBrB,IAAlB;AACD,GAlBM,CAAP;AAmBD","file":"reader.gpx.js","sourcesContent":["import logger from 'loglevel'\r\nimport i18next from 'i18next'\r\nimport { gpx } from '@tmcw/togeojson'\r\n\r\nexport function readGPX (file, options) {\r\n return new Promise((resolve, reject) => {\r\n const reader = new FileReader()\r\n reader.onloadend = () => {\r\n let content = reader.result\r\n try {\r\n content = gpx(new DOMParser().parseFromString(content, 'text/xml'))\r\n } catch (error) {\r\n logger.debug(error)\r\n reject(new Error(i18next.t('errors.INVALID_GPX_FILE', { file: file.name }), { errors: error }))\r\n return\r\n }\r\n resolve(content)\r\n }\r\n reader.onerror = (error) => {\r\n logger.debug(error)\r\n reject(new Error(i18next.t('errors.CANNOT_READ_FILE', { file: file.name }), { errors: error }))\r\n }\r\n reader.readAsText(file)\r\n })\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../map/client/readers/reader.kml.js"],"names":["readKML","file","options","Promise","resolve","reject","reader","FileReader","onloadend","content","result","DOMParser","parseFromString","error","logger","debug","Error","i18next","t","name","errors","onerror","readAsText"],"mappings":";;;;;QAIgBA,O,GAAAA,O;;AAJhB;;;;AACA;;;;AACA;;;;AAEO,SAASA,OAAT,CAAkBC,IAAlB,EAAwBC,OAAxB,EAAiC;AACtC,SAAO,IAAIC,OAAJ,CAAY,CAACC,OAAD,EAAUC,MAAV,KAAqB;AACtC,UAAMC,SAAS,IAAIC,UAAJ,EAAf;AACAD,WAAOE,SAAP,GAAmB,MAAM;AACvB,UAAIC,UAAUH,OAAOI,MAArB;AACA,UAAI;AACFD,kBAAU,oBAAI,IAAIE,SAAJ,GAAgBC,eAAhB,CAAgCH,OAAhC,EAAyC,UAAzC,CAAJ,CAAV;AACD,OAFD,CAEE,OAAOI,KAAP,EAAc;AACdC,2BAAOC,KAAP,CAAaF,KAAb;AACAR,eAAO,IAAIW,KAAJ,CAAUC,kBAAQC,CAAR,CAAU,yBAAV,EAAqC,EAAEjB,MAAMA,KAAKkB,IAAb,EAArC,CAAV,EAAqE,EAAEC,QAAQP,KAAV,EAArE,CAAP;AACA;AACD;AACDT,cAAQK,OAAR;AACD,KAVD;AAWAH,WAAOe,OAAP,GAAkBR,KAAD,IAAW;AAC1BC,yBAAOC,KAAP,CAAaF,KAAb;AACAR,aAAO,IAAIW,KAAJ,CAAUC,kBAAQC,CAAR,CAAU,yBAAV,EAAqC,EAAEjB,MAAMA,KAAKkB,IAAb,EAArC,CAAV,EAAqE,EAAEC,QAAQP,KAAV,EAArE,CAAP;AACD,KAHD;AAIAP,WAAOgB,UAAP,CAAkBrB,IAAlB;AACD,GAlBM,CAAP;AAmBD","file":"reader.kml.js","sourcesContent":["import logger from 'loglevel'\r\nimport i18next from 'i18next'\r\nimport { kml } from '@tmcw/togeojson'\r\n\r\nexport function readKML (file, options) {\r\n return new Promise((resolve, reject) => {\r\n const reader = new FileReader()\r\n reader.onloadend = () => {\r\n let content = reader.result\r\n try {\r\n content = kml(new DOMParser().parseFromString(content, 'text/xml'))\r\n } catch (error) {\r\n logger.debug(error)\r\n reject(new Error(i18next.t('errors.INVALID_KML_FILE', { file: file.name }), { errors: error }))\r\n return\r\n }\r\n resolve(content)\r\n }\r\n reader.onerror = (error) => {\r\n logger.debug(error)\r\n reject(new Error(i18next.t('errors.CANNOT_READ_FILE', { file: file.name }), { errors: error }))\n }\r\n reader.readAsText(file)\r\n })\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../../map/client/readers/reader.kml.js"],"names":["readKML","file","options","Promise","resolve","reject","reader","FileReader","onloadend","content","result","DOMParser","parseFromString","error","logger","debug","Error","i18next","t","name","errors","onerror","readAsText"],"mappings":";;;;;QAIgBA,O,GAAAA,O;;AAJhB;;;;AACA;;;;AACA;;;;AAEO,SAASA,OAAT,CAAkBC,IAAlB,EAAwBC,OAAxB,EAAiC;AACtC,SAAO,IAAIC,OAAJ,CAAY,CAACC,OAAD,EAAUC,MAAV,KAAqB;AACtC,UAAMC,SAAS,IAAIC,UAAJ,EAAf;AACAD,WAAOE,SAAP,GAAmB,MAAM;AACvB,UAAIC,UAAUH,OAAOI,MAArB;AACA,UAAI;AACFD,kBAAU,oBAAI,IAAIE,SAAJ,GAAgBC,eAAhB,CAAgCH,OAAhC,EAAyC,UAAzC,CAAJ,CAAV;AACD,OAFD,CAEE,OAAOI,KAAP,EAAc;AACdC,2BAAOC,KAAP,CAAaF,KAAb;AACAR,eAAO,IAAIW,KAAJ,CAAUC,kBAAQC,CAAR,CAAU,yBAAV,EAAqC,EAAEjB,MAAMA,KAAKkB,IAAb,EAArC,CAAV,EAAqE,EAAEC,QAAQP,KAAV,EAArE,CAAP;AACA;AACD;AACDT,cAAQK,OAAR;AACD,KAVD;AAWAH,WAAOe,OAAP,GAAkBR,KAAD,IAAW;AAC1BC,yBAAOC,KAAP,CAAaF,KAAb;AACAR,aAAO,IAAIW,KAAJ,CAAUC,kBAAQC,CAAR,CAAU,yBAAV,EAAqC,EAAEjB,MAAMA,KAAKkB,IAAb,EAArC,CAAV,EAAqE,EAAEC,QAAQP,KAAV,EAArE,CAAP;AACD,KAHD;AAIAP,WAAOgB,UAAP,CAAkBrB,IAAlB;AACD,GAlBM,CAAP;AAmBD","file":"reader.kml.js","sourcesContent":["import logger from 'loglevel'\r\nimport i18next from 'i18next'\r\nimport { kml } from '@tmcw/togeojson'\r\n\r\nexport function readKML (file, options) {\r\n return new Promise((resolve, reject) => {\r\n const reader = new FileReader()\r\n reader.onloadend = () => {\r\n let content = reader.result\r\n try {\r\n content = kml(new DOMParser().parseFromString(content, 'text/xml'))\r\n } catch (error) {\r\n logger.debug(error)\r\n reject(new Error(i18next.t('errors.INVALID_KML_FILE', { file: file.name }), { errors: error }))\r\n return\r\n }\r\n resolve(content)\r\n }\r\n reader.onerror = (error) => {\r\n logger.debug(error)\r\n reject(new Error(i18next.t('errors.CANNOT_READ_FILE', { file: file.name }), { errors: error }))\r\n }\r\n reader.readAsText(file)\r\n })\r\n}\r\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kalisio/kdk",
|
|
3
3
|
"description": "Kalisio Development Kit",
|
|
4
|
-
"version": "1.5.
|
|
4
|
+
"version": "1.5.1",
|
|
5
5
|
"homepage": "https://github.com/kalisio/kdk",
|
|
6
6
|
"main": "lib/",
|
|
7
7
|
"keywords": [
|
|
@@ -96,7 +96,6 @@
|
|
|
96
96
|
"@feathersjs/express": "^1.2.3",
|
|
97
97
|
"@feathersjs/feathers": "^3.3.1",
|
|
98
98
|
"@feathersjs/socketio": "^3.2.2",
|
|
99
|
-
"@geoman-io/leaflet-geoman-free": "^2.11.1",
|
|
100
99
|
"abort-controller": "^3.0.0",
|
|
101
100
|
"aws-sdk": "^2.200.0",
|
|
102
101
|
"body-parser": "^1.17.1",
|