@ingissa/navcore-mapbox 1.0.9 → 1.0.11
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/LICENSE +3 -3
- package/README.md +102 -0
- package/package.json +2 -2
package/LICENSE
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
Copyright (c) 2026 Abdelnasser Aitabi. All rights reserved.
|
|
2
|
-
|
|
3
|
-
No license is granted except by separate written agreement.
|
|
1
|
+
Copyright (c) 2026 Abdelnasser Aitabi. All rights reserved.
|
|
2
|
+
|
|
3
|
+
No license is granted except by separate written agreement.
|
package/README.md
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# @ingissa/navcore-mapbox
|
|
2
|
+
|
|
3
|
+
[Official Website](https://navcore-web.vercel.app/)
|
|
4
|
+
|
|
5
|
+
> Mapbox Directions provider adapter for the NavCore navigation engine.
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@ingissa/navcore-mapbox)
|
|
8
|
+

|
|
9
|
+
[](https://www.typescriptlang.org/)
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Overview
|
|
14
|
+
|
|
15
|
+
`@ingissa/navcore-mapbox` provides `MapboxDirectionsProvider`, an implementation of NavCore's `DirectionsProvider` interface targeting the Mapbox Directions API.
|
|
16
|
+
|
|
17
|
+
### Key Capabilities
|
|
18
|
+
- **Direct NavCore integration**: Directly compatible with `createNavigationSession` and `createRoutePlan`.
|
|
19
|
+
- **Automatic waypoint chunking**: Transparently splits routes with more than 25 waypoints into chunks, querying each chunk and stitching geometry with the `OVERLAP_1` strategy.
|
|
20
|
+
- **Configurable routing profiles**: Supports `driving`, `driving-traffic`, `cycling`, and `walking`.
|
|
21
|
+
|
|
22
|
+
> [!NOTE]
|
|
23
|
+
> `@ingissa/navcore-mapbox` is a routing directions provider only. It does not export a map renderer. For map rendering in React Native, use `@rnmapbox/maps` or `react-native-maps` directly in your application components by consuming state from `useNavSelector()`.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install @ingissa/navcore-mapbox @ingissa/navcore-core
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Peer Dependencies
|
|
34
|
+
- `@ingissa/navcore-core`: `^1.0.9` (required)
|
|
35
|
+
- `@rnmapbox/maps`: `>=10.0.0` (optional, for React Native applications)
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Quickstart
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
import { createNavigationSession } from '@ingissa/navcore-core';
|
|
43
|
+
import { MapboxDirectionsProvider } from '@ingissa/navcore-mapbox';
|
|
44
|
+
|
|
45
|
+
// Initialize Mapbox provider with your access token
|
|
46
|
+
const provider = new MapboxDirectionsProvider({
|
|
47
|
+
accessToken: 'pk.eyJ1...',
|
|
48
|
+
profile: 'driving-traffic', // 'driving' | 'driving-traffic' | 'cycling' | 'walking'
|
|
49
|
+
maxWaypointsPerChunk: 25, // Default: 25 (Mapbox API limit)
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// Pass to a NavigationSession
|
|
53
|
+
const nav = createNavigationSession({
|
|
54
|
+
provider,
|
|
55
|
+
providerName: 'mapbox',
|
|
56
|
+
engineOptions: { isDev: true },
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
// Fetch route and start navigation
|
|
60
|
+
const plan = await nav.navigate({
|
|
61
|
+
origin: [2.3522, 48.8566],
|
|
62
|
+
destination: [2.3009, 48.8741],
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
console.log(`Route loaded: ${plan.distanceM}m, duration: ${plan.durationS}s`);
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Standalone Usage
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
import { MapboxDirectionsProvider } from '@ingissa/navcore-mapbox';
|
|
74
|
+
|
|
75
|
+
const provider = new MapboxDirectionsProvider({
|
|
76
|
+
accessToken: process.env.MAPBOX_TOKEN!,
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
const result = await provider.getRoute([
|
|
80
|
+
[2.3522, 48.8566],
|
|
81
|
+
[2.3300, 48.8650],
|
|
82
|
+
[2.3009, 48.8741],
|
|
83
|
+
]);
|
|
84
|
+
|
|
85
|
+
console.log('Coordinates:', result.geometry.length);
|
|
86
|
+
console.log('Distance in metres:', result.distance);
|
|
87
|
+
console.log('Duration in seconds:', result.duration);
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## Documentation
|
|
93
|
+
|
|
94
|
+
- [Directions Providers Guide](https://github.com/ingissa/navcore-sdk/blob/main/docs/directions-providers.md)
|
|
95
|
+
- [API Reference](https://github.com/ingissa/navcore-sdk/blob/main/docs/api-reference/navcore-mapbox.md)
|
|
96
|
+
- [Official Website](https://navcore-web.vercel.app/)
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Licensing
|
|
101
|
+
|
|
102
|
+
Proprietary software. Copyright (c) 2026 Abdelnasser Aitabi. All rights reserved. No license is granted except by separate written agreement.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ingissa/navcore-mapbox",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.11",
|
|
4
4
|
"description": "Mapbox GL adapter for NavCore — renderer and directions provider.",
|
|
5
5
|
"author": "Ingissa <8abnav@gmail.com>",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"prepublishOnly": "npm run build --prefix ../.. && node ../../scripts/check-release.mjs"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@ingissa/navcore-core": "^1.0.
|
|
35
|
+
"@ingissa/navcore-core": "^1.0.11",
|
|
36
36
|
"@rnmapbox/maps": ">=10.0.0"
|
|
37
37
|
},
|
|
38
38
|
"peerDependenciesMeta": {
|