cesium-heatbox 0.1.17 → 0.1.18
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 +15 -0
- package/README.md +164 -0
- package/dist/cesium-heatbox.min.js +1 -1
- package/dist/cesium-heatbox.min.js.map +1 -1
- package/dist/cesium-heatbox.umd.min.js +1 -1
- package/dist/cesium-heatbox.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/tools/wiki-sync.js +81 -50
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
9
9
|
|
|
10
10
|
> **Note**: 将来の予定・ロードマップは [ROADMAP.md](ROADMAP.md) および [GitHub Issues](https://github.com/hiro-nyon/cesium-heatbox/issues) で管理されています。
|
|
11
11
|
|
|
12
|
+
## [0.1.18] - 2025-11-18
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
- **Layer aggregation pipeline**: `Heatbox` の `aggregation` オプションでレイヤカテゴリ別にボクセルを集計し、`layerStats`/`layerTop`/`layers`(トップN)などの統計を取得できるようにしました。プロパティベースと `keyResolver` の両方をサポートし、ピッキング説明文にもレイヤ構成を表示できます。
|
|
16
|
+
- **Examples & ADR**: `examples/aggregation/*` と `docs/adr/ADR-0014-v0.1.18-voxel-layer-aggregation.md` を追加し、単一/複数ソースのユースケースや推奨値を示しました。
|
|
17
|
+
- **Helper utilities**: `src/utils/cesiumProperty.js`、`src/utils/escapeHtml.js` を追加し、レイヤ統計の整形と Cesium Property ラッパーを共通化しました。
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
- **DataProcessor / GeometryRenderer**: レイヤ集計のために内部データ構造を拡張し、グローバル統計とピッキング説明を自動生成するよう更新しました。
|
|
21
|
+
- **Validation & constants**: 参照テーブルを拡充し、`aggregation.topN` や `aggregation.byProperty` などの検証を強化しました。
|
|
22
|
+
- **テスト**: `test/core/aggregation.test.js`、`test/integration/aggregation.test.js`、`test/performance/aggregation-performance.test.js` を追加/拡張し、層別集計の回帰・性能を担保しました。
|
|
23
|
+
|
|
24
|
+
### Documentation
|
|
25
|
+
- README/Wiki にレイヤ集計ガイドを追記し、日本語/英語のコード例、ベストプラクティス、Spatial ID セットアップガイドを更新しました。
|
|
26
|
+
|
|
12
27
|
## [0.1.15-alpha.4] - 2025-10-10
|
|
13
28
|
|
|
14
29
|
### Added
|
package/README.md
CHANGED
|
@@ -521,6 +521,170 @@ const heatbox = new Heatbox(viewer, {
|
|
|
521
521
|
|
|
522
522
|
See [Spatial ID Examples](examples/spatial-id/) for details.
|
|
523
523
|
|
|
524
|
+
## レイヤ別集約 / Layer Aggregation
|
|
525
|
+
|
|
526
|
+
### 日本語
|
|
527
|
+
|
|
528
|
+
**v0.1.18新機能**: ボクセル内のエンティティをカテゴリ・種別・データソース等のレイヤで集約できるようになりました。
|
|
529
|
+
|
|
530
|
+
#### 概要
|
|
531
|
+
|
|
532
|
+
従来のボクセルごとの総エンティティ数に加え、各ボクセル内のエンティティを**レイヤ(カテゴリ)別**に集計できます:
|
|
533
|
+
|
|
534
|
+
- **プロパティベース集約**: エンティティの特定プロパティをレイヤキーとして使用
|
|
535
|
+
- **カスタムリゾルバ**: 任意のロジックでレイヤキーを決定
|
|
536
|
+
- **ボクセルごとの内訳**: 各ボクセルの支配的レイヤ(layerTop)と詳細内訳(layerStats)
|
|
537
|
+
- **グローバル統計**: 全ボクセルを通じた上位Nレイヤの集計
|
|
538
|
+
- **ピッキング統合**: ボクセルクリック時にレイヤ構成を表示
|
|
539
|
+
|
|
540
|
+
#### 基本的な使用方法
|
|
541
|
+
|
|
542
|
+
```javascript
|
|
543
|
+
import { Heatbox } from 'cesium-heatbox';
|
|
544
|
+
|
|
545
|
+
// プロパティベース集約(建物種別)
|
|
546
|
+
const heatbox = new Heatbox(viewer, {
|
|
547
|
+
aggregation: {
|
|
548
|
+
enabled: true,
|
|
549
|
+
byProperty: 'buildingType', // entity.properties.buildingType をレイヤキーとして使用
|
|
550
|
+
showInDescription: true, // ボクセル説明文にレイヤ内訳を表示
|
|
551
|
+
topN: 10 // 統計情報で上位10レイヤを返却
|
|
552
|
+
}
|
|
553
|
+
});
|
|
554
|
+
|
|
555
|
+
await heatbox.createFromEntities(entities);
|
|
556
|
+
|
|
557
|
+
// グローバル統計の確認
|
|
558
|
+
const stats = heatbox.getStatistics();
|
|
559
|
+
console.log(stats.layers);
|
|
560
|
+
// [
|
|
561
|
+
// { key: 'residential', total: 5234 },
|
|
562
|
+
// { key: 'commercial', total: 2103 },
|
|
563
|
+
// { key: 'industrial', total: 987 }
|
|
564
|
+
// ]
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
#### カスタムリゾルバ
|
|
568
|
+
|
|
569
|
+
```javascript
|
|
570
|
+
const heatbox = new Heatbox(viewer, {
|
|
571
|
+
aggregation: {
|
|
572
|
+
enabled: true,
|
|
573
|
+
keyResolver: (entity) => {
|
|
574
|
+
// カスタムロジックでレイヤキーを決定
|
|
575
|
+
const hour = new Date(entity.timestamp).getHours();
|
|
576
|
+
return hour < 12 ? 'morning' : 'afternoon';
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
});
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
#### ボクセルピッキング
|
|
583
|
+
|
|
584
|
+
ボクセルをクリックすると、レイヤ構成が表示されます:
|
|
585
|
+
|
|
586
|
+
```
|
|
587
|
+
ボクセル構成:
|
|
588
|
+
- residential: 30 (60%)
|
|
589
|
+
- commercial: 15 (30%)
|
|
590
|
+
- industrial: 5 (10%)
|
|
591
|
+
```
|
|
592
|
+
|
|
593
|
+
#### ベストプラクティス
|
|
594
|
+
|
|
595
|
+
- **カテゴリカルキーを使用**: タイムスタンプやIDなど連続値は避け、カテゴリ値を使用してください
|
|
596
|
+
- **ユニークレイヤ数を制限**: ボクセルあたり100未満のユニークレイヤを推奨
|
|
597
|
+
- **エラーハンドリング**: `keyResolver`は文字列を返すべきです。エラー時は'unknown'にフォールバックします
|
|
598
|
+
|
|
599
|
+
#### パフォーマンス
|
|
600
|
+
|
|
601
|
+
- **メモリ**: ボクセルあたりのユニークレイヤあたり ~8-16 バイト
|
|
602
|
+
- **処理時間**: 有効時 ≤ +10% オーバーヘッド
|
|
603
|
+
- **無効時**: オーバーヘッドなし(デフォルト)
|
|
604
|
+
|
|
605
|
+
詳細は[集約使用例](examples/aggregation/)を参照してください。
|
|
606
|
+
|
|
607
|
+
### English
|
|
608
|
+
|
|
609
|
+
**v0.1.18 New Feature**: Aggregate entities within voxels by category, type, data source, or custom layers.
|
|
610
|
+
|
|
611
|
+
#### Overview
|
|
612
|
+
|
|
613
|
+
In addition to total entity counts per voxel, you can now aggregate entities by **layers (categories)**:
|
|
614
|
+
|
|
615
|
+
- **Property-based aggregation**: Use a specific entity property as the layer key
|
|
616
|
+
- **Custom resolver**: Determine layer keys with arbitrary logic
|
|
617
|
+
- **Per-voxel breakdown**: Dominant layer (layerTop) and detailed breakdown (layerStats) for each voxel
|
|
618
|
+
- **Global statistics**: Top-N layer aggregation across all voxels
|
|
619
|
+
- **Picking integration**: Display layer composition when clicking voxels
|
|
620
|
+
|
|
621
|
+
#### Basic Usage
|
|
622
|
+
|
|
623
|
+
```javascript
|
|
624
|
+
import { Heatbox } from 'cesium-heatbox';
|
|
625
|
+
|
|
626
|
+
// Property-based aggregation (building types)
|
|
627
|
+
const heatbox = new Heatbox(viewer, {
|
|
628
|
+
aggregation: {
|
|
629
|
+
enabled: true,
|
|
630
|
+
byProperty: 'buildingType', // Use entity.properties.buildingType as layer key
|
|
631
|
+
showInDescription: true, // Show layer breakdown in voxel description
|
|
632
|
+
topN: 10 // Return top 10 layers in statistics
|
|
633
|
+
}
|
|
634
|
+
});
|
|
635
|
+
|
|
636
|
+
await heatbox.createFromEntities(entities);
|
|
637
|
+
|
|
638
|
+
// Check global statistics
|
|
639
|
+
const stats = heatbox.getStatistics();
|
|
640
|
+
console.log(stats.layers);
|
|
641
|
+
// [
|
|
642
|
+
// { key: 'residential', total: 5234 },
|
|
643
|
+
// { key: 'commercial', total: 2103 },
|
|
644
|
+
// { key: 'industrial', total: 987 }
|
|
645
|
+
// ]
|
|
646
|
+
```
|
|
647
|
+
|
|
648
|
+
#### Custom Resolver
|
|
649
|
+
|
|
650
|
+
```javascript
|
|
651
|
+
const heatbox = new Heatbox(viewer, {
|
|
652
|
+
aggregation: {
|
|
653
|
+
enabled: true,
|
|
654
|
+
keyResolver: (entity) => {
|
|
655
|
+
// Custom logic to determine layer key
|
|
656
|
+
const hour = new Date(entity.timestamp).getHours();
|
|
657
|
+
return hour < 12 ? 'morning' : 'afternoon';
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
});
|
|
661
|
+
```
|
|
662
|
+
|
|
663
|
+
#### Voxel Picking
|
|
664
|
+
|
|
665
|
+
When you click a voxel, the layer composition is displayed:
|
|
666
|
+
|
|
667
|
+
```
|
|
668
|
+
Voxel Composition:
|
|
669
|
+
- residential: 30 (60%)
|
|
670
|
+
- commercial: 15 (30%)
|
|
671
|
+
- industrial: 5 (10%)
|
|
672
|
+
```
|
|
673
|
+
|
|
674
|
+
#### Best Practices
|
|
675
|
+
|
|
676
|
+
- **Use categorical keys**: Avoid continuous values like timestamps or IDs; use categorical values
|
|
677
|
+
- **Limit unique layers**: Keep unique layer count < 100 per voxel for optimal performance
|
|
678
|
+
- **Error handling**: `keyResolver` should return strings; errors fall back to 'unknown'
|
|
679
|
+
|
|
680
|
+
#### Performance
|
|
681
|
+
|
|
682
|
+
- **Memory**: ~8-16 bytes per unique layer per voxel
|
|
683
|
+
- **Processing**: ≤ +10% overhead when enabled
|
|
684
|
+
- **No overhead**: When disabled (default)
|
|
685
|
+
|
|
686
|
+
See [Aggregation Examples](examples/aggregation/) for details.
|
|
687
|
+
|
|
524
688
|
## API
|
|
525
689
|
|
|
526
690
|
### 日本語
|