sharemap-maplib-js 0.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 +100 -0
- package/dist/sharemap-maplib-js.umd.js +131 -0
- package/package.json +34 -0
- package/src/index.js +66 -0
package/README.md
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# sharemap-maplib-js
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
## Features
|
|
5
|
+
|
|
6
|
+
- `sharemapServiceKey` / `sharemap-service-key`: send a ShareMap service key with requests
|
|
7
|
+
- `modeKey`: choose whether the service key is sent via HTTP header or query string
|
|
8
|
+
- `style`: pass a style URL directly to the map, or use pre-defined aliases `default` / `bright` / `dark`
|
|
9
|
+
- bundled `maplibre-gl` inside the UMD build so no external `maplibre-gl` script tag is required
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
import { ShareMapLibre } from 'sharemap-maplib-js';
|
|
15
|
+
|
|
16
|
+
const map = new ShareMapLibre({
|
|
17
|
+
container: 'map',
|
|
18
|
+
sharemapServiceKey: 'YOUR_SERVICE_KEY',
|
|
19
|
+
modeKey: 'header', // or 'query'
|
|
20
|
+
center: [106.7, 10.78],
|
|
21
|
+
zoom: 12
|
|
22
|
+
});
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Style examples
|
|
26
|
+
|
|
27
|
+
```js
|
|
28
|
+
// default ShareMap style
|
|
29
|
+
new ShareMapLibre({
|
|
30
|
+
container: 'map',
|
|
31
|
+
sharemapServiceKey: 'YOUR_SERVICE_KEY',
|
|
32
|
+
style: 'default'
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
// bright style alias
|
|
36
|
+
new ShareMapLibre({
|
|
37
|
+
container: 'map',
|
|
38
|
+
sharemapServiceKey: 'YOUR_SERVICE_KEY',
|
|
39
|
+
style: 'bright'
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// dark style alias
|
|
43
|
+
new ShareMapLibre({
|
|
44
|
+
container: 'map',
|
|
45
|
+
sharemapServiceKey: 'YOUR_SERVICE_KEY',
|
|
46
|
+
style: 'dark'
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// custom remote style URL
|
|
50
|
+
new ShareMapLibre({
|
|
51
|
+
container: 'map',
|
|
52
|
+
sharemapServiceKey: 'YOUR_SERVICE_KEY',
|
|
53
|
+
style: 'https://example.com/style.json'
|
|
54
|
+
});
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Installation
|
|
58
|
+
|
|
59
|
+
Install from npm:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
npm install sharemap-maplib-js
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
## CDN usag
|
|
67
|
+
|
|
68
|
+
```html
|
|
69
|
+
<script src="https://your-cdn.com/sharemap-maplib-js.umd.js"></script>
|
|
70
|
+
<script>
|
|
71
|
+
const map = new ShareMapLite.ShareMapLibre({
|
|
72
|
+
container: 'map',
|
|
73
|
+
sharemapServiceKey: 'YOUR_SERVICE_KEY',
|
|
74
|
+
style: 'default',
|
|
75
|
+
modeKey: 'header',
|
|
76
|
+
center: [106.7, 10.78],
|
|
77
|
+
zoom: 12
|
|
78
|
+
});
|
|
79
|
+
</script>
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Published CDN URLs
|
|
83
|
+
|
|
84
|
+
After publishing to npm, use either:
|
|
85
|
+
|
|
86
|
+
- jsDelivr:
|
|
87
|
+
- `https://cdn.jsdelivr.net/npm/sharemap-maplib-js/dist/sharemap-maplib-js.umd.js`
|
|
88
|
+
- versioned: `https://cdn.jsdelivr.net/npm/sharemap-maplib-js@0.0.1/dist/sharemap-maplib-js.umd.js`
|
|
89
|
+
- unpkg:
|
|
90
|
+
- `https://unpkg.com/sharemap-maplib-js/dist/sharemap-maplib-js.umd.js`
|
|
91
|
+
- versioned: `https://unpkg.com/sharemap-maplib-js@0.0.1/dist/sharemap-maplib-js.umd.js`
|
|
92
|
+
- npmcdn:
|
|
93
|
+
- `https://npmcdn.com/sharemap-maplib-js/dist/sharemap-maplib-js.umd.js`
|
|
94
|
+
- versioned: `https://npmcdn.com/sharemap-maplib-js@0.0.1/dist/sharemap-maplib-js.umd.js`
|
|
95
|
+
|
|
96
|
+
Package page:
|
|
97
|
+
|
|
98
|
+
- `https://www.npmjs.com/package/sharemap-maplib-js`
|
|
99
|
+
|
|
100
|
+
|