aviation-chart 0.3.25 → 2.0.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/README.md +1 -170
- package/dist/nav-sdk.d.ts +30 -2297
- package/dist/nav-sdk.esm.js +286 -757
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,170 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
A high-performance aviation chart SDK providing complete aeronautical data visualization: FIR/UIR, controlled and restricted airspace, airways, navaids (VOR/NDB), airports and runways, AMM, and terrain — plus business features such as NOTAM, ADS-B, and weather radar. Built with a modular architecture supporting plugins, performance optimization, and unified error handling.
|
|
4
|
-
|
|
5
|
-
## ✨ Features
|
|
6
|
-
|
|
7
|
-
- **Aviation data stack**: FIR, controlled/restricted airspace, airways, VOR/NDB, airport runways, AMM, terrain/contours — published per AIRAC period
|
|
8
|
-
- **Theme switching**: in-place light/dark recoloring that never covers your overlay layers
|
|
9
|
-
- **Business modules**: NOTAM, ADS-B, weather radar, raster layers
|
|
10
|
-
- **Performance**: LOD (level-of-detail), lazy layer loading, massive-point clustering, low-zoom style simplification
|
|
11
|
-
- **Plugin system**: unified plugin interface with a built-in measurement plugin
|
|
12
|
-
- **Unified error handling**: centralized error management, fallback strategies, error statistics
|
|
13
|
-
|
|
14
|
-
## 🚀 Getting Started
|
|
15
|
-
|
|
16
|
-
### Option 1: CDN script (global `navMap`)
|
|
17
|
-
|
|
18
|
-
```html
|
|
19
|
-
<!-- latest -->
|
|
20
|
-
<script src="https://aips.siniswift.com/sdk/nav-sdk.min.js"></script>
|
|
21
|
-
<!-- or pin a version -->
|
|
22
|
-
<!-- <script src="https://aips.siniswift.com/sdk/nav-sdk@0.2.0.min.js"></script> -->
|
|
23
|
-
|
|
24
|
-
<div id="map" style="width:100%;height:600px;"></div>
|
|
25
|
-
|
|
26
|
-
<script>
|
|
27
|
-
const sdk = new navMap.MapSDK({
|
|
28
|
-
container: 'map',
|
|
29
|
-
center: [116.3974, 39.9093],
|
|
30
|
-
zoom: 4,
|
|
31
|
-
theme: 'light', // 'light' | 'dark'
|
|
32
|
-
period: '202606', // AIRAC period; auto-computed if omitted
|
|
33
|
-
});
|
|
34
|
-
</script>
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
> The underlying map engine is bundled into `nav-sdk.min.js` — no extra script needed.
|
|
38
|
-
|
|
39
|
-
### Option 2: npm
|
|
40
|
-
|
|
41
|
-
```bash
|
|
42
|
-
npm install aviation-chart
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
```javascript
|
|
46
|
-
import { MapSDK, MeasurePlugin } from 'aviation-chart';
|
|
47
|
-
|
|
48
|
-
const sdk = new MapSDK({
|
|
49
|
-
container: 'map',
|
|
50
|
-
center: [116.3974, 39.9093],
|
|
51
|
-
zoom: 4,
|
|
52
|
-
performance: { lodEnabled: true, clusteringEnabled: true, lazyLoadingEnabled: true },
|
|
53
|
-
});
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
## 📚 API Overview
|
|
57
|
-
|
|
58
|
-
### Initialization options
|
|
59
|
-
|
|
60
|
-
| Option | Description |
|
|
61
|
-
|---|---|
|
|
62
|
-
| `container` | Container id or element (required) |
|
|
63
|
-
| `center` / `zoom` | Initial center and zoom |
|
|
64
|
-
| `theme` | `'light'` / `'dark'` |
|
|
65
|
-
| `period` | AIRAC period `YYYYMM` |
|
|
66
|
-
| `apiUrl` | Chart data service URL, default `https://aips.siniswift.com` |
|
|
67
|
-
| `layers` | Initial layer visibility, e.g. `{ airspace: true, controlled: false, terrain: false }` |
|
|
68
|
-
| `performance` | `{ lodEnabled, clusteringEnabled, lazyLoadingEnabled }` |
|
|
69
|
-
| `errorHandler` | Custom error handler function |
|
|
70
|
-
|
|
71
|
-
### Layer control
|
|
72
|
-
|
|
73
|
-
Layer groups: `airspace` (FIR), `airline` (airways), `controlled`, `restricted`, `vor`, `ndb`, `airport`, `runway`, `adiz`, `waypointOffAirway`, `amm`, `terrain`, `contour`, `background`, `landLayer`, `boundary`.
|
|
74
|
-
|
|
75
|
-
```javascript
|
|
76
|
-
// Two equivalent APIs
|
|
77
|
-
sdk.setLayerVisible('airspace', true);
|
|
78
|
-
sdk.addBuiltInLayer('controlled');
|
|
79
|
-
sdk.toggleBuiltInLayer('airline');
|
|
80
|
-
sdk.removeBuiltInLayer('restricted');
|
|
81
|
-
|
|
82
|
-
// Theme and period
|
|
83
|
-
sdk.setTheme('dark');
|
|
84
|
-
sdk.setPeriod('202609');
|
|
85
|
-
|
|
86
|
-
// LOD
|
|
87
|
-
sdk.layerManager.setLODEnabled(true);
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
### Feature drawing (GeoJSON)
|
|
91
|
-
|
|
92
|
-
```javascript
|
|
93
|
-
sdk.addPoint([lng, lat], properties, style);
|
|
94
|
-
sdk.addLine(coordinates, properties, style);
|
|
95
|
-
sdk.addPolygon(coordinates, properties, style);
|
|
96
|
-
|
|
97
|
-
// Cluster massive point sets
|
|
98
|
-
sdk.geoJSONManager.setClusteringEnabled(true);
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
### Business features
|
|
102
|
-
|
|
103
|
-
```javascript
|
|
104
|
-
sdk.notam.open(true); // NOTAM
|
|
105
|
-
sdk.adsb.open(); // ADS-B
|
|
106
|
-
sdk.api.getRadarData(); // weather radar data
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
### Popup
|
|
110
|
-
|
|
111
|
-
```javascript
|
|
112
|
-
const popup = new navMap.Popup()
|
|
113
|
-
.setLngLat([lng, lat])
|
|
114
|
-
.setHTML('<h3>Title</h3>')
|
|
115
|
-
.addTo(sdk.map);
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
### Plugins
|
|
119
|
-
|
|
120
|
-
```javascript
|
|
121
|
-
const measure = new navMap.MeasurePlugin();
|
|
122
|
-
sdk.use(measure);
|
|
123
|
-
measure.enable('distance'); // 'distance' | 'area'
|
|
124
|
-
measure.disable();
|
|
125
|
-
|
|
126
|
-
const plugin = sdk.getPlugin('measure');
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
### Underlying engine passthrough
|
|
130
|
-
|
|
131
|
-
The SDK passes through the full underlying map-engine API — call methods directly on the instance, or access the raw instance via `sdk.map`:
|
|
132
|
-
|
|
133
|
-
```javascript
|
|
134
|
-
sdk.flyTo({ center: [lng, lat], zoom: 8 });
|
|
135
|
-
sdk.setPaintProperty('airline', 'line-color', '#0057c8');
|
|
136
|
-
sdk.queryRenderedFeatures([x, y]);
|
|
137
|
-
|
|
138
|
-
const map = sdk.map; // raw map instance
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
### Error & performance
|
|
142
|
-
|
|
143
|
-
```javascript
|
|
144
|
-
const sdk = new navMap.MapSDK({
|
|
145
|
-
container: 'map',
|
|
146
|
-
errorHandler: (error) => console.error(error.code, error.details),
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
sdk.getErrorStats(); // error statistics
|
|
150
|
-
sdk.getPerformanceStats(); // performance statistics
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
## 🔧 Writing a Plugin
|
|
154
|
-
|
|
155
|
-
```javascript
|
|
156
|
-
export class MyPlugin {
|
|
157
|
-
name = 'my-plugin';
|
|
158
|
-
version = '1.0.0';
|
|
159
|
-
install(sdk) { /* install logic */ }
|
|
160
|
-
uninstall(sdk) { /* uninstall logic */ }
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
const plugin = new MyPlugin();
|
|
164
|
-
sdk.use(plugin);
|
|
165
|
-
sdk.pluginManager.hasPlugin('my-plugin');
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
## 📄 License
|
|
169
|
-
|
|
170
|
-
MIT License
|
|
1
|
+
## Kunyu
|