@kalisio/kdk 2.2.0 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/core/api/application.js +1 -1
  2. package/core/client/components/KModal.vue +1 -1
  3. package/core/client/components/form/KForm.vue +6 -2
  4. package/core/client/components/media/KColorScale.vue +1 -1
  5. package/core/client/exporter.js +14 -8
  6. package/core/client/units.js +3 -3
  7. package/core/client/utils/utils.shapes.js +1 -1
  8. package/extras/icons/wind-speed-0.svg +8 -0
  9. package/extras/icons/wind-speed-10.svg +8 -0
  10. package/extras/icons/wind-speed-100.svg +12 -0
  11. package/extras/icons/wind-speed-105.svg +13 -0
  12. package/extras/icons/wind-speed-15.svg +9 -0
  13. package/extras/icons/wind-speed-20.svg +9 -0
  14. package/extras/icons/wind-speed-25.svg +10 -0
  15. package/extras/icons/wind-speed-30.svg +10 -0
  16. package/extras/icons/wind-speed-35.svg +11 -0
  17. package/extras/icons/wind-speed-40.svg +11 -0
  18. package/extras/icons/wind-speed-45.svg +12 -0
  19. package/extras/icons/wind-speed-5.svg +9 -0
  20. package/extras/icons/wind-speed-50.svg +9 -0
  21. package/extras/icons/wind-speed-55.svg +10 -0
  22. package/extras/icons/wind-speed-60.svg +10 -0
  23. package/extras/icons/wind-speed-65.svg +11 -0
  24. package/extras/icons/wind-speed-70.svg +11 -0
  25. package/extras/icons/wind-speed-75.svg +12 -0
  26. package/extras/icons/wind-speed-80.svg +12 -0
  27. package/extras/icons/wind-speed-85.svg +13 -0
  28. package/extras/icons/wind-speed-90.svg +13 -0
  29. package/extras/icons/wind-speed-95.svg +14 -0
  30. package/map/api/hooks/hooks.query.js +34 -11
  31. package/map/client/cesium/utils/index.js +2 -1
  32. package/map/client/cesium/utils/utils.features.js +8 -0
  33. package/map/client/cesium/utils/utils.style.js +4 -4
  34. package/map/client/components/KLayerStyleForm.vue +32 -24
  35. package/map/client/components/KTimezoneMap.vue +3 -4
  36. package/map/client/components/catalog/KConnectLayer.vue +14 -10
  37. package/map/client/components/legend/KColorScaleLegend.vue +6 -2
  38. package/map/client/components/legend/KLayerLegend.vue +13 -3
  39. package/map/client/components/legend/KLegend.vue +12 -10
  40. package/map/client/components/location/KLocationCardSection.vue +8 -4
  41. package/map/client/components/widget/KTimeSeries.vue +0 -6
  42. package/map/client/composables/catalog.js +17 -2
  43. package/map/client/composables/highlight.js +9 -30
  44. package/map/client/composables/probe.js +4 -1
  45. package/map/client/composables/weather.js +3 -3
  46. package/map/client/i18n/map_en.json +4 -0
  47. package/map/client/i18n/map_fr.json +4 -0
  48. package/map/client/leaflet/ShapeMarker.js +23 -12
  49. package/map/client/leaflet/TiledFeatureLayer.js +38 -8
  50. package/map/client/leaflet/TiledMeshLayer.js +3 -1
  51. package/map/client/leaflet/utils/utils.style.js +7 -3
  52. package/map/client/mixins/globe/mixin.base-globe.js +29 -16
  53. package/map/client/mixins/globe/mixin.geojson-layers.js +7 -0
  54. package/map/client/mixins/map/mixin.base-map.js +40 -17
  55. package/map/client/mixins/map/mixin.geojson-layers.js +7 -3
  56. package/map/client/mixins/mixin.activity.js +5 -1
  57. package/map/client/planets.js +8 -0
  58. package/map/client/utils/utils.catalog.js +17 -0
  59. package/map/client/utils/utils.layers.js +2 -1
  60. package/map/client/utils/utils.style.js +12 -0
  61. package/map/common/wms-utils.js +8 -3
  62. package/package.json +1 -1
  63. package/test/client/core/layout.js +0 -1
  64. package/test/client/map/catalog.js +1 -1
@@ -174,7 +174,7 @@ async function createService (name, app, options = {}) {
174
174
  paginate,
175
175
  multi: true,
176
176
  whitelist: [
177
- '$exists', '$and', '$or', '$eq', '$elemMatch', '$distinct', '$groupBy', '$group', '$regex',
177
+ '$exists', '$and', '$or', '$not', '$eq', '$elemMatch', '$distinct', '$groupBy', '$group', '$regex',
178
178
  '$text', '$search', '$caseSensitive', '$language', '$diacriticSensitive',
179
179
  '$aggregate', '$near', '$nearSphere', '$geoIntersects', '$geoWithin',
180
180
  '$maxDistance', '$minDistance', '$geometry', '$box', '$polygon', '$center', '$centerSphere'
@@ -112,7 +112,7 @@ const xlMinWidths = { wide: 90, medium: 55, narrow: 25 }
112
112
  const computedStyle = computed(() => {
113
113
  // compute the modal max height
114
114
  const screenHeight = $q.screen.height
115
- const modalMaxHeight = props.maximized ? screenHeight : 0.8 * screenHeight
115
+ const modalMaxHeight = props.maximized ? screenHeight : 0.9 * screenHeight
116
116
  // compute the scroll area max height
117
117
  // take into account the header and footer height
118
118
  let contentMaxHeight = modalMaxHeight - headerHeight.value
@@ -23,7 +23,7 @@
23
23
  Grouped fields
24
24
  -->
25
25
  <template v-for="(group, id) in groups" :key="id">
26
- <q-expansion-item icon="las la-file-alt" :group="id">
26
+ <q-expansion-item v-show="group.hasFields" icon="las la-file-alt" :group="id">
27
27
  <template v-slot:header>
28
28
  <!-- Label -->
29
29
  <q-item-section>
@@ -105,7 +105,11 @@ let buildInProgress = false
105
105
 
106
106
  // Computed
107
107
  const groups = computed(() => {
108
- if (schema.value && schema.value.groups) return schema.value.groups
108
+ if (schema.value && schema.value.groups) {
109
+ return _.mapValues(schema.value.groups, (group, id) => Object.assign({
110
+ hasFields: _.find(fields.value, { group: id })
111
+ }, group))
112
+ }
109
113
  return {}
110
114
  })
111
115
 
@@ -117,7 +117,7 @@ function drawLabel () {
117
117
  let xLabel = canvas.width
118
118
  switch (labelAlign.value) {
119
119
  case 'left':
120
- xLabel = 0
120
+ xLabel = 0
121
121
  break
122
122
  case 'center':
123
123
  xLabel = canvas.width / 2
@@ -26,9 +26,12 @@ const ExporterQueue = {
26
26
  const request = this.pendingRequests.shift()
27
27
  try {
28
28
  // compute a filename
29
- const timestamp = moment().toISOString().replace(/:/g, '-')
30
- let filename = `${_.get(request, 'basename', request.service)}_${timestamp}.${request.format}`
31
- if (_.get(request, 'gzip', true)) filename += '.gz'
29
+ let filename = request.filename
30
+ if (!filename) {
31
+ const timestamp = moment().toISOString().replace(/:/g, '-')
32
+ filename = `${_.get(request, 'basename', request.service)}_${timestamp}.${request.format}`
33
+ if (_.get(request, 'gzip', true)) filename += '.gz'
34
+ }
32
35
  // retrienve the target service path
33
36
  const servicePath = api.getServicePath(request.service).substring(1)
34
37
  // retrieve the transform assigned to the format
@@ -104,8 +107,10 @@ export const Exporter = {
104
107
  message: i18n.t('exporter.MESSAGE'),
105
108
  options: {
106
109
  type: 'radio',
107
- model: options.formats[0].value,
108
- items: options.formats
110
+ model: options.formats[0].label,
111
+ items: options.formats.map(format => {
112
+ return { label: format.label, value: format.label }
113
+ })
109
114
  },
110
115
  cancel: {
111
116
  id: 'cancel-button',
@@ -121,8 +126,9 @@ export const Exporter = {
121
126
  persistent: true
122
127
  }
123
128
  Dialog.create(dialog)
124
- .onOk((format) => {
125
- if (!ExporterQueue.push(Object.assign(params, { format }))) {
129
+ .onOk((formatLabel) => {
130
+ const format = _.find(options.formats, { label: formatLabel })
131
+ if (!ExporterQueue.push(Object.assign(params, format))) {
126
132
  Notify.create({
127
133
  type: 'negative',
128
134
  message: i18n.t('exporter.EXPORTS_LIMIT_REACHED')
@@ -130,7 +136,7 @@ export const Exporter = {
130
136
  }
131
137
  })
132
138
  } else {
133
- if (!ExporterQueue.push(Object.assign(params, { format: options.formats[0].value }))) {
139
+ if (!ExporterQueue.push(Object.assign(params, options.formats[0]))) {
134
140
  Notify.create({
135
141
  type: 'negative',
136
142
  message: i18n.t('exporter.EXPORTS_LIMIT_REACHED')
@@ -289,7 +289,7 @@ export const Units = {
289
289
  // Get unit symbol by unit name
290
290
  getUnitSymbol (unit) {
291
291
  const definition = this.getUnit(unit)
292
- return (definition ? i18n.t(definition.symbol) : unit)
292
+ return (definition ? i18n.tie(definition.symbol) : unit)
293
293
  },
294
294
  // Get default unit definition (if any) for a given quantity/unit name
295
295
  getDefaultUnit (quantityOrUnit) {
@@ -319,7 +319,7 @@ export const Units = {
319
319
  // If target unit is not specified will use default unit (if any) for source unit
320
320
  convert (value, sourceUnit, targetUnit) {
321
321
  if (_.isNil(value)) {
322
- logger.warn(`[KDK] cannont convert an nil value`)
322
+ logger.warn('[KDK] cannont convert an nil value')
323
323
  return
324
324
  }
325
325
  if (value === Number.MIN_VALUE || value === Number.MAX_VALUE) return value
@@ -340,7 +340,7 @@ export const Units = {
340
340
  // options are mathjs format options
341
341
  format (value, sourceUnit, targetUnit, options) {
342
342
  if (_.isNil(value)) {
343
- logger.warn(`[KDK] cannot format a nil value`)
343
+ logger.warn('[KDK] cannot format a nil value')
344
344
  return
345
345
  }
346
346
  // If target unit is not given use default one
@@ -113,7 +113,7 @@ function getSize (size) {
113
113
  - join: String - the stroke linejoin - 'miter'
114
114
  - dashArray: String - the stroke dasharray - 'none'
115
115
  - dashOffset: Number - the stroke dashoffset - 0
116
- - icon: Object specifying an icon overlay
116
+ - icon: Object specifying an icon overlay, can also be a custom L.Icon object instance
117
117
  - classes: String - the icon class
118
118
  - url: String - the icon url
119
119
  - color: String - the icon color
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="200" height="200" viewBox="-25 -25 50 50">
4
+ <desc id="en">Observed wind speed: 0–2 knots</desc>
5
+ <g style="fill:none; stroke:black; stroke-width:2.5;">
6
+ <circle r="18"/>
7
+ </g>
8
+ </svg>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="200" height="200" viewBox="-48 -33 50 50">
4
+ <desc id="en">Observed wind speed: 8–12 knots</desc>
5
+ <g style="fill:none; stroke:black; stroke-width:2;">
6
+ <path d="M 0,0 h -40 l -5,-17"/>
7
+ </g>
8
+ </svg>
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="200" height="200" viewBox="-48 -33 50 50">
4
+ <desc id="en">Observed wind speed: 98–102 knots</desc>
5
+ <g style="fill:black; stroke:none; stroke-width:0;">
6
+ <path d="M -44,1 L -44,0 L -39,-17.25 L -34,0 L -34,1"/>
7
+ <path d="M -34,1 L -34,0 L -29,-17.25 L -24,0 L -24,1"/>
8
+ </g>
9
+ <g style="fill:none; stroke:black; stroke-width:2;">
10
+ <path d="M 0,0 h -40"/>
11
+ </g>
12
+ </svg>
@@ -0,0 +1,13 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="200" height="200" viewBox="-48 -33 50 50">
4
+ <desc id="en">Observed wind speed: 102–107 knots</desc>
5
+ <g style="fill:black; stroke:none; stroke-width:0;">
6
+ <path d="M -44,1 L -44,0 L -39,-17.25 L -34,0 L -34,1"/>
7
+ <path d="M -34,1 L -34,0 L -29,-17.25 L -24,0 L -24,1"/>
8
+ </g>
9
+ <g style="fill:none; stroke:black; stroke-width:2;">
10
+ <path d="M 0,0 h -40"/>
11
+ <path d="M -20,0 l -2.5,-8.5"/>
12
+ </g>
13
+ </svg>
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="200" height="200" viewBox="-48 -33 50 50">
4
+ <desc id="en">Observed wind speed: 13–17 knots</desc>
5
+ <g style="fill:none; stroke:black; stroke-width:2;">
6
+ <path d="M 0,0 h -40 l -5,-17"/>
7
+ <path d="M -35,0 l -2.5,-8.5"/>
8
+ </g>
9
+ </svg>
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="200" height="200" viewBox="-48 -33 50 50">
4
+ <desc id="en">Observed wind speed: 18–22 knots</desc>
5
+ <g style="fill:none; stroke:black; stroke-width:2;">
6
+ <path d="M 0,0 h -40 l -5,-17"/>
7
+ <path d="M -35,0 l -5,-17"/>
8
+ </g>
9
+ </svg>
@@ -0,0 +1,10 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="200" height="200" viewBox="-48 -33 50 50">
4
+ <desc id="en">Observed wind speed: 23–27 knots</desc>
5
+ <g style="fill:none; stroke:black; stroke-width:2;">
6
+ <path d="M 0,0 h -40 l -5,-17"/>
7
+ <path d="M -35,0 l -5,-17"/>
8
+ <path d="M -30,0 l -2.5,-8.5"/>
9
+ </g>
10
+ </svg>
@@ -0,0 +1,10 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="200" height="200" viewBox="-48 -33 50 50">
4
+ <desc id="en">Observed wind speed: 28–32 knots</desc>
5
+ <g style="fill:none; stroke:black; stroke-width:2;">
6
+ <path d="M 0,0 h -40 l -5,-17"/>
7
+ <path d="M -35,0 l -5,-17"/>
8
+ <path d="M -30,0 l -5,-17"/>
9
+ </g>
10
+ </svg>
@@ -0,0 +1,11 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="200" height="200" viewBox="-48 -33 50 50">
4
+ <desc id="en">Observed wind speed: 33–37 knots</desc>
5
+ <g style="fill:none; stroke:black; stroke-width:2;">
6
+ <path d="M 0,0 h -40 l -5,-17"/>
7
+ <path d="M -35,0 l -5,-17"/>
8
+ <path d="M -30,0 l -5,-17"/>
9
+ <path d="M -25,0 l -2.5,-8.5"/>
10
+ </g>
11
+ </svg>
@@ -0,0 +1,11 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="200" height="200" viewBox="-48 -33 50 50">
4
+ <desc id="en">Observed wind speed: 38–42 knots</desc>
5
+ <g style="fill:none; stroke:black; stroke-width:2;">
6
+ <path d="M 0,0 h -40 l -5,-17"/>
7
+ <path d="M -35,0 l -5,-17"/>
8
+ <path d="M -30,0 l -5,-17"/>
9
+ <path d="M -25,0 l -5,-17"/>
10
+ </g>
11
+ </svg>
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="200" height="200" viewBox="-48 -33 50 50">
4
+ <desc id="en">Observed wind speed: 43–47 knots</desc>
5
+ <g style="fill:none; stroke:black; stroke-width:2;">
6
+ <path d="M 0,0 h -40 l -5,-17"/>
7
+ <path d="M -35,0 l -5,-17"/>
8
+ <path d="M -30,0 l -5,-17"/>
9
+ <path d="M -25,0 l -5,-17"/>
10
+ <path d="M -20,0 l -2.5,-8.5"/>
11
+ </g>
12
+ </svg>
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="200" height="200" viewBox="-48 -33 50 50">
4
+ <desc id="en">Observed wind speed: 3–7 knots</desc>
5
+ <g style="fill:none; stroke:black; stroke-width:2;">
6
+ <path d="M 0,0 h -40"/>
7
+ <path d="M -35,0 l -2.5,-8.5"/>
8
+ </g>
9
+ </svg>
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="200" height="200" viewBox="-48 -33 50 50">
4
+ <desc id="en">Observed wind speed: 63–67 knots</desc>
5
+ <path style="fill:black; stroke:none; stroke-width:0;" d="M -44,1 L -44,0 L -39,-17.25 L -34,0 L -34,1"/>
6
+ <g style="fill:none; stroke:black; stroke-width:2;">
7
+ <path d="M 0,0 h -40"/>
8
+ </g>
9
+ </svg>
@@ -0,0 +1,10 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="200" height="200" viewBox="-48 -33 50 50">
4
+ <desc id="en">Observed wind speed: 53–57 knots</desc>
5
+ <path style="fill:black; stroke:none; stroke-width:0;" d="M -44,1 L -44,0 L -39,-17.25 L -34,0 L -34,1"/>
6
+ <g style="fill:none; stroke:black; stroke-width:2;">
7
+ <path d="M 0,0 h -40"/>
8
+ <path d="M -30,0 l -2.5,-8.5"/>
9
+ </g>
10
+ </svg>
@@ -0,0 +1,10 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="200" height="200" viewBox="-48 -33 50 50">
4
+ <desc id="en">Observed wind speed: 58–62 knots</desc>
5
+ <path style="fill:black; stroke:none; stroke-width:0;" d="M -44,1 L -44,0 L -39,-17.25 L -34,0 L -34,1"/>
6
+ <g style="fill:none; stroke:black; stroke-width:2;">
7
+ <path d="M 0,0 h -40"/>
8
+ <path d="M -30,0 l -5,-17"/>
9
+ </g>
10
+ </svg>
@@ -0,0 +1,11 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="200" height="200" viewBox="-48 -33 50 50">
4
+ <desc id="en">Observed wind speed: 63–67 knots</desc>
5
+ <path style="fill:black; stroke:none; stroke-width:0;" d="M -44,1 L -44,0 L -39,-17.25 L -34,0 L -34,1"/>
6
+ <g style="fill:none; stroke:black; stroke-width:2;">
7
+ <path d="M 0,0 h -40"/>
8
+ <path d="M -30,0 l -5,-17"/>
9
+ <path d="M -25,0 l -2.5,-8.5"/>
10
+ </g>
11
+ </svg>
@@ -0,0 +1,11 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="200" height="200" viewBox="-48 -33 50 50">
4
+ <desc id="en">Observed wind speed: 68–72 knots</desc>
5
+ <path style="fill:black; stroke:none; stroke-width:0;" d="M -44,1 L -44,0 L -39,-17.25 L -34,0 L -34,1"/>
6
+ <g style="fill:none; stroke:black; stroke-width:2;">
7
+ <path d="M 0,0 h -40"/>
8
+ <path d="M -30,0 l -5,-17"/>
9
+ <path d="M -25,0 l -5,-17"/>
10
+ </g>
11
+ </svg>
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="200" height="200" viewBox="-48 -33 50 50">
4
+ <desc id="en">Observed wind speed: 73–77 knots</desc>
5
+ <path style="fill:black; stroke:none; stroke-width:0;" d="M -44,1 L -44,0 L -39,-17.25 L -34,0 L -34,1"/>
6
+ <g style="fill:none; stroke:black; stroke-width:2;">
7
+ <path d="M 0,0 h -40"/>
8
+ <path d="M -30,0 l -5,-17"/>
9
+ <path d="M -25,0 l -5,-17"/>
10
+ <path d="M -20,0 l -2.5,-8.5"/>
11
+ </g>
12
+ </svg>
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="200" height="200" viewBox="-48 -33 50 50">
4
+ <desc id="en">Observed wind speed: 78–82 knots</desc>
5
+ <path style="fill:black; stroke:none; stroke-width:0;" d="M -44,1 L -44,0 L -39,-17.25 L -34,0 L -34,1"/>
6
+ <g style="fill:none; stroke:black; stroke-width:2;">
7
+ <path d="M 0,0 h -40"/>
8
+ <path d="M -30,0 l -5,-17"/>
9
+ <path d="M -25,0 l -5,-17"/>
10
+ <path d="M -20,0 l -5,-17"/>
11
+ </g>
12
+ </svg>
@@ -0,0 +1,13 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="200" height="200" viewBox="-48 -33 50 50">
4
+ <desc id="en">Observed wind speed: 83–87 knots</desc>
5
+ <path style="fill:black; stroke:none; stroke-width:0;" d="M -44,1 L -44,0 L -39,-17.25 L -34,0 L -34,1"/>
6
+ <g style="fill:none; stroke:black; stroke-width:2;">
7
+ <path d="M 0,0 h -40"/>
8
+ <path d="M -30,0 l -5,-17"/>
9
+ <path d="M -25,0 l -5,-17"/>
10
+ <path d="M -20,0 l -5,-17"/>
11
+ <path d="M -15,0 l -2.5,-8.5"/>
12
+ </g>
13
+ </svg>
@@ -0,0 +1,13 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="200" height="200" viewBox="-48 -33 50 50">
4
+ <desc id="en">Observed wind speed: 88–92 knots</desc>
5
+ <path style="fill:black; stroke:none; stroke-width:0;" d="M -44,1 L -44,0 L -39,-17.25 L -34,0 L -34,1"/>
6
+ <g style="fill:none; stroke:black; stroke-width:2;">
7
+ <path d="M 0,0 h -40"/>
8
+ <path d="M -30,0 l -5,-17"/>
9
+ <path d="M -25,0 l -5,-17"/>
10
+ <path d="M -20,0 l -5,-17"/>
11
+ <path d="M -15,0 l -5,-17"/>
12
+ </g>
13
+ </svg>
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="200" height="200" viewBox="-48 -33 50 50">
4
+ <desc id="en">Observed wind speed: 93–97 knots</desc>
5
+ <path style="fill:black; stroke:none; stroke-width:0;" d="M -44,1 L -44,0 L -39,-17.25 L -34,0 L -34,1"/>
6
+ <g style="fill:none; stroke:black; stroke-width:2;">
7
+ <path d="M 0,0 h -40"/>
8
+ <path d="M -30,0 l -5,-17"/>
9
+ <path d="M -25,0 l -5,-17"/>
10
+ <path d="M -20,0 l -5,-17"/>
11
+ <path d="M -15,0 l -5,-17"/>
12
+ <path d="M -10,0 l -2.5,-8.5"/>
13
+ </g>
14
+ </svg>
@@ -30,6 +30,17 @@ function getGeometryQueryForBBox (bbox) {
30
30
  }
31
31
  }
32
32
  }
33
+
34
+ export function marshallGeoJsonQuery (hook) {
35
+ const query = hook.params.query
36
+ if (query) {
37
+ if (query.geoJson) {
38
+ delete query.geoJson
39
+ hook.params.asGeoJson = true
40
+ }
41
+ }
42
+ }
43
+
33
44
  export function marshallSpatialQuery (hook) {
34
45
  const query = hook.params.query
35
46
  if (query) {
@@ -116,11 +127,9 @@ export function marshallSpatialQuery (hook) {
116
127
  }
117
128
  query.geometry = geometryQuery
118
129
  }
119
- if (query.geoJson) {
120
- delete query.geoJson
121
- hook.params.asGeoJson = true
122
- }
123
130
  }
131
+ // Include GeoJson query by default
132
+ marshallGeoJsonQuery(hook)
124
133
  }
125
134
 
126
135
  export function asGeoJson (options = {}) {
@@ -139,6 +148,9 @@ export function asGeoJson (options = {}) {
139
148
  const isPaginated = !_.isNil(results.data)
140
149
  const pagination = (isPaginated ? _.pick(results, ['total', 'skip', 'limit']) : {})
141
150
  results = (isPaginated ? results.data : results)
151
+ // Single item case, i.e. GET ?
152
+ const isFeatureCollection = Array.isArray(results)
153
+ if (!isFeatureCollection) results = [results]
142
154
  results = results
143
155
  .filter(item => {
144
156
  // Check if item is not already in GeoJson feature format and we can convert if required
@@ -190,24 +202,35 @@ export function asGeoJson (options = {}) {
190
202
  // Move some data to properties ?
191
203
  if (options.properties) {
192
204
  results.forEach(item => {
193
- options.properties.forEach(mapping => {
194
- if (mapping.from) _.set(item, `properties.${mapping.to || mapping.from}`, _.get(item, `${mapping.from}`))
195
- if (mapping.delete) _.unset(item, `${mapping.from}`)
196
- })
205
+ // True indicates to move all fields to properties
206
+ if (options.properties === true) {
207
+ _.forOwn(item, (value, key) => {
208
+ if ((key === 'geometry') || (key === 'type') || (key === '_id')) return
209
+ _.set(item, `properties.${key}`, _.get(item, key))
210
+ _.unset(item, key)
211
+ })
212
+ } else { // Else we expect a specific mapping
213
+ options.properties.forEach(mapping => {
214
+ if (mapping.from) _.set(item, `properties.${mapping.to || mapping.from}`, _.get(item, `${mapping.from}`))
215
+ if (mapping.delete) _.unset(item, `${mapping.from}`)
216
+ })
217
+ }
197
218
  })
198
219
  }
199
- // Copy pagination information if any so that client can use it anyway
200
- if (_.get(options, 'asFeatureCollection', true)) {
220
+ // If we should make it available as a GeoJson feature collection create it
221
+ if (isFeatureCollection && _.get(options, 'asFeatureCollection', true)) {
222
+ // Copy pagination information if any so that client can use it anyway
201
223
  _.set(hook, options.dataPath || 'result', Object.assign({
202
224
  type: 'FeatureCollection',
203
225
  features: results
204
226
  }, pagination)) // If no pagination this merged object will be empty
205
227
  } else if (isPaginated) {
228
+ // Copy pagination information if any so that client can use it anyway
206
229
  _.set(hook, options.dataPath || 'result', Object.assign({
207
230
  data: results
208
231
  }, pagination))
209
232
  } else {
210
- _.set(hook, options.dataPath || 'result', results)
233
+ _.set(hook, options.dataPath || 'result', isFeatureCollection ? results : results[0])
211
234
  }
212
235
  }
213
236
  }
@@ -1,3 +1,4 @@
1
1
  export * from './utils.events.js'
2
2
  export * from './utils.popup.js'
3
- export * from './utils.style.js'
3
+ export * from './utils.style.js'
4
+ export * from './utils.features.js'
@@ -0,0 +1,8 @@
1
+ import { kml } from '@tmcw/togeojson'
2
+ import Cesium from 'cesium/Source/Cesium.js'
3
+
4
+ export async function convertEntitiesToGeoJson(entities) {
5
+ const kmlEntities = await Cesium.exportKml({ entities, modelCallback: () => '' })
6
+ const parser = new DOMParser()
7
+ return kml(parser.parseFromString(kmlEntities.kml, 'application/xml'))
8
+ }
@@ -3,7 +3,7 @@ import chroma from 'chroma-js'
3
3
  import moment from 'moment'
4
4
  import Cesium from 'cesium/Source/Cesium.js'
5
5
  import { Time, Units } from '../../../../core/client/index.js'
6
- import { convertPointStyleToSimpleStyle, convertLineStyleToSimpleStyle, convertPolygonStyleToSimpleStyle,
6
+ import { convertPointStyleToSimpleStyle, convertLineStyleToSimpleStyle, convertPolygonStyleToSimpleStyle, convertSimpleStyleColors,
7
7
  convertSimpleStyleToPointStyle, convertSimpleStyleToLineStyle, convertSimpleStyleToPolygonStyle,
8
8
  PointStyleTemplateMappings, LineStyleTemplateMappings, PolygonStyleTemplateMappings } from '../../utils/utils.style.js'
9
9
 
@@ -64,7 +64,7 @@ export function getPointSimpleStyle (feature, options, engine, engineStylePath =
64
64
  const featureStyle = feature.style ? _.get(feature, 'style', {}) : convertSimpleStyleToPointStyle(feature.properties)
65
65
  const style = _.merge({}, engineStyle, layerStyle, featureStyle)
66
66
  processStyle({ style: { point: style } }, feature, options, PointStyleTemplateMappings)
67
- return convertPointStyleToSimpleStyle(style)
67
+ return convertSimpleStyleColors(convertPointStyleToSimpleStyle(style))
68
68
  }
69
69
 
70
70
  export function getLineSimpleStyle (feature, options, engine, engineStylePath = 'style.line') {
@@ -73,7 +73,7 @@ export function getLineSimpleStyle (feature, options, engine, engineStylePath =
73
73
  const featureStyle = feature.style ? _.get(feature, 'style', {}) : convertSimpleStyleToLineStyle(feature.properties)
74
74
  const style = _.merge({}, engineStyle, layerStyle, featureStyle)
75
75
  processStyle({ style: { line: style } }, feature, options, LineStyleTemplateMappings)
76
- return convertLineStyleToSimpleStyle(style)
76
+ return convertSimpleStyleColors(convertLineStyleToSimpleStyle(style))
77
77
  }
78
78
 
79
79
  export function getPolygonSimpleStyle (feature, options, engine, engineStylePath = 'style.polygon') {
@@ -82,7 +82,7 @@ export function getPolygonSimpleStyle (feature, options, engine, engineStylePath
82
82
  const featureStyle = feature.style ? _.get(feature, 'style', {}) : convertSimpleStyleToPolygonStyle(feature.properties)
83
83
  const style = _.merge({}, engineStyle, layerStyle, featureStyle)
84
84
  processStyle({ style: { polygon: style } }, feature, options, PolygonStyleTemplateMappings)
85
- return convertPolygonStyleToSimpleStyle(style)
85
+ return convertSimpleStyleColors(convertPolygonStyleToSimpleStyle(style))
86
86
  }
87
87
 
88
88
  export function convertToCesiumObjects (style) {