@aapicoits/powermap-web-sdk 1.0.1 β 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +85 -12
- package/dist/index.d.ts +409 -226
- package/dist/powermap-web-sdk.cjs.cjs +19 -19
- package/dist/powermap-web-sdk.js +1446 -1024
- package/dist/powermap-web-sdk.umd.cjs +16 -16
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -945,16 +945,42 @@ map.on('geometrySelectionChanged', ({ features }) => {
|
|
|
945
945
|
|
|
946
946
|
## 16. π Indoor Mapping
|
|
947
947
|
|
|
948
|
-
The PowerMap SDK provides a robust API for managing indoor environments
|
|
948
|
+
The PowerMap SDK provides a robust API for managing indoor environments with **OGC IMDF 1.0.0 Full Compliance** β supporting all 16 standard feature types, ZIP archive import/export, and schema validation.
|
|
949
949
|
|
|
950
|
-
|
|
950
|
+
> [!TIP]
|
|
951
|
+
> For the complete IMDF reference including all feature types, properties, archive format, and validation β see [GEOMETRY.md](./GEOMETRY.md#ogc-imdf-100-compliance)
|
|
952
|
+
|
|
953
|
+
### 16.1 Indoor Venue Selection (NEW)
|
|
951
954
|
|
|
952
|
-
|
|
955
|
+
The new `loadIndoorMap()` API lets you select and activate a venue from pre-loaded data. It handles mode switching, floor detection, and camera fitting automatically.
|
|
953
956
|
|
|
954
957
|
```javascript
|
|
955
|
-
|
|
958
|
+
// 1. Load data from your API
|
|
959
|
+
const data = await fetch('/api/venues/siam-paragon/features').then(r => r.json());
|
|
960
|
+
map.geometry.import(data);
|
|
961
|
+
|
|
962
|
+
// 2. Select venue β auto enters indoor mode
|
|
963
|
+
const result = map.loadIndoorMap('siam_paragon');
|
|
964
|
+
console.log(result.floors); // [0, 1, 2, 3, 4]
|
|
965
|
+
console.log(result.currentFloor); // 0
|
|
966
|
+
|
|
967
|
+
// 3. Switch floors
|
|
968
|
+
map.setFloor(2); // Convenience alias for map.indoor.setFloor()
|
|
969
|
+
|
|
970
|
+
// 4. Query venue metadata
|
|
971
|
+
map.indoor.getVenueInfo(); // { id, name, floors, bounds, buildingCount }
|
|
972
|
+
map.indoor.getFloorInfo(2); // { name, unitCount, poiCount, beaconCount }
|
|
973
|
+
|
|
974
|
+
// 5. Exit
|
|
975
|
+
map.unloadIndoorMap();
|
|
956
976
|
```
|
|
957
977
|
|
|
978
|
+
| Method | Returns | Description |
|
|
979
|
+
| :--- | :--- | :--- |
|
|
980
|
+
| `loadIndoorMap(venueId, opts)` | `{ venue, floors, currentFloor }` | Select venue, enter indoor mode, fit bounds |
|
|
981
|
+
| `setFloor(level, opts)` | `PowerMap` | Convenience alias for `map.indoor.setFloor()` |
|
|
982
|
+
| `unloadIndoorMap()` | `PowerMap` | Exit indoor mode, clear selection |
|
|
983
|
+
|
|
958
984
|
### 16.2 Floor Management (`map.indoor`)
|
|
959
985
|
|
|
960
986
|
When in indoor mode, use the `map.indoor` facade to control the vertical context of the map.
|
|
@@ -964,6 +990,11 @@ When in indoor mode, use the `map.indoor` facade to control the vertical context
|
|
|
964
990
|
| `setFloor(ordinal, opts)` | `number, Object` | Switch to a specific floor level (e.g., 1, 2, -1). |
|
|
965
991
|
| `getAvailableFloors()` | - | Returns a sorted array of all unique floor ordinals found in the map data. |
|
|
966
992
|
| `getCurrentFloor()` | - | Returns the ordinal of the currently active floor. |
|
|
993
|
+
| `getActiveVenue()` | - | Returns the currently selected venue feature or `null`. |
|
|
994
|
+
| `getVenues()` | - | Lists all venue features in loaded data. |
|
|
995
|
+
| `getVenueInfo()` | - | Summary of active venue (name, floors, bounds, building count). |
|
|
996
|
+
| `getFloorInfo(ordinal)` | `number` | Floor details (unit count, POI count, beacon count). |
|
|
997
|
+
| `getBuildings()` | - | Lists all building features in loaded data. |
|
|
967
998
|
|
|
968
999
|
#### Switching Floors with Animation
|
|
969
1000
|
|
|
@@ -992,19 +1023,58 @@ map.indoor.setCategoryVisible('walkway', true); // Navigation Paths
|
|
|
992
1023
|
map.indoor.setCategoryVisible('obstacle', true); // 3D Obstacles/Buildings
|
|
993
1024
|
```
|
|
994
1025
|
|
|
995
|
-
### 16.4 Indoor Data Kinds
|
|
1026
|
+
### 16.4 Indoor Data Kinds (IMDF Compliant)
|
|
996
1027
|
|
|
997
|
-
The SDK categorizes indoor features using
|
|
1028
|
+
The SDK categorizes indoor features using `user_kind` (or `kind`) mapped to OGC IMDF `feature_type`:
|
|
998
1029
|
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1030
|
+
| SDK Kind | IMDF Feature Type | Geometry | Description |
|
|
1031
|
+
| :--- | :--- | :--- | :--- |
|
|
1032
|
+
| `venue` | venue | Polygon | Main venue (mall, airport) |
|
|
1033
|
+
| `building` | building | Polygon | Building within venue |
|
|
1034
|
+
| `floor` | level | Polygon | Floor plan surface |
|
|
1035
|
+
| `unit` | unit | Polygon | Room, corridor, area |
|
|
1036
|
+
| `opening` | opening | LineString | Door, gate, passage |
|
|
1037
|
+
| `amenity` | amenity | Point | ATM, restroom, etc. |
|
|
1038
|
+
| `anchor` | anchor | Point | Reference point |
|
|
1039
|
+
| `footprint` | footprint | Polygon | Building shadow |
|
|
1040
|
+
| `fixture` | fixture | Polygon | Furniture, permanent |
|
|
1041
|
+
| `section` | section | Polygon | Zone, terminal |
|
|
1042
|
+
| `geofence` | geofence | Polygon | Virtual fence |
|
|
1043
|
+
| `kiosk` | kiosk | Polygon | Service booth |
|
|
1044
|
+
| `detail` | detail | LineString | Crosswalk, railing |
|
|
1045
|
+
| `beacon` | anchor (beacon) | Point | BLE beacon device |
|
|
1046
|
+
| `poi` | anchor (poi) | Point | Point of interest |
|
|
1047
|
+
| `walkway` | pathway | LineString | Indoor navigation path |
|
|
1048
|
+
| `obstacle` | unit (restricted) | Polygon | Non-walkable area |
|
|
1049
|
+
|
|
1050
|
+
### 16.5 IMDF Archive & Validation
|
|
1004
1051
|
|
|
1005
|
-
|
|
1052
|
+
```javascript
|
|
1053
|
+
import { IMDFArchive, IMDFValidator } from '@powermap/web-sdk';
|
|
1054
|
+
|
|
1055
|
+
// Export as IMDF ZIP archive
|
|
1056
|
+
const blob = await IMDFArchive.toArchive(map.geometry.export());
|
|
1057
|
+
|
|
1058
|
+
// Import IMDF ZIP archive
|
|
1059
|
+
const fc = await IMDFArchive.fromArchive(zipFile);
|
|
1060
|
+
map.geometry.import(fc);
|
|
1061
|
+
|
|
1062
|
+
// Validate IMDF data
|
|
1063
|
+
const result = IMDFValidator.validate(map.geometry.export());
|
|
1064
|
+
if (!result.valid) console.error(result.errors);
|
|
1065
|
+
```
|
|
1066
|
+
|
|
1067
|
+
> [!NOTE]
|
|
1068
|
+
> IMDF Archive requires [JSZip](https://stuk.github.io/jszip/) as an optional dependency.
|
|
1069
|
+
|
|
1070
|
+
### 16.6 Event Synchronization
|
|
1006
1071
|
|
|
1007
1072
|
```javascript
|
|
1073
|
+
// Listen for venue selection
|
|
1074
|
+
map.on('indoorMapLoaded', ({ venue, floors, currentFloor }) => {
|
|
1075
|
+
console.log(`Entered: ${venue.properties?.name?.en}`);
|
|
1076
|
+
});
|
|
1077
|
+
|
|
1008
1078
|
// Listen for mode changes
|
|
1009
1079
|
map.on('onModeChanged', ({ mode }) => {
|
|
1010
1080
|
console.log(`Mode switched to: ${mode}`); // 'standard' or 'indoor'
|
|
@@ -1114,6 +1184,9 @@ The SDK emits the following events through its central `EventBus`. You can subsc
|
|
|
1114
1184
|
| Event | Payload | Description |
|
|
1115
1185
|
|---|---|---|
|
|
1116
1186
|
| `floorChanged` | `ordinal (number)` | Fired when the active indoor floor changes. |
|
|
1187
|
+
| `venueChanged` | `VenueInfo` | Fired when the active venue selection changes. |
|
|
1188
|
+
| `indoorMapLoaded` | `{ venue, floors, currentFloor }` | Fired when a venue is successfully selected via `loadIndoorMap()`. |
|
|
1189
|
+
| `indoorMapUnloaded` | `-` | Fired when indoor mode is exited via `unloadIndoorMap()`. |
|
|
1117
1190
|
|
|
1118
1191
|
### πΊοΈ Routing & Navigation
|
|
1119
1192
|
| Event | Payload | Description |
|