@geolonia/maps-core 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/LICENSE +21 -0
- package/README.md +135 -0
- package/dist/index.cjs +1881 -0
- package/dist/index.d.cts +206 -0
- package/dist/index.d.ts +206 -0
- package/dist/index.js +1841 -0
- package/package.json +54 -0
- package/src/assets/style.css +166 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Geolonia Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# @geolonia/maps-core
|
|
2
|
+
|
|
3
|
+
Core library for Geolonia Maps. Extends [MapLibre GL JS](https://maplibre.org/) with Geolonia Maps platform integration.
|
|
4
|
+
|
|
5
|
+
Designed to be side-effect-free and DOM-independent, serving as the shared foundation for downstream packages such as maps-embed and maps-react.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @geolonia/maps-core maplibre-gl
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
`maplibre-gl` is a peer dependency.
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import 'maplibre-gl/dist/maplibre-gl.css';
|
|
19
|
+
import '@geolonia/maps-core/css';
|
|
20
|
+
import { GeoloniaMap } from '@geolonia/maps-core';
|
|
21
|
+
|
|
22
|
+
const map = new GeoloniaMap({
|
|
23
|
+
container: '#map',
|
|
24
|
+
apiKey: 'YOUR-API-KEY',
|
|
25
|
+
style: 'geolonia/basic-v2',
|
|
26
|
+
center: [139.7671, 35.6812],
|
|
27
|
+
zoom: 14,
|
|
28
|
+
});
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Using External Styles Without API Key
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
const map = new GeoloniaMap({
|
|
35
|
+
container: '#map',
|
|
36
|
+
style: 'https://tile.openstreetmap.jp/styles/osm-bright/style.json',
|
|
37
|
+
center: [139.7671, 35.6812],
|
|
38
|
+
zoom: 14,
|
|
39
|
+
});
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Geolonia API key is only required when using Geolonia's hosted styles and tiles.
|
|
43
|
+
|
|
44
|
+
## API
|
|
45
|
+
|
|
46
|
+
### `GeoloniaMap`
|
|
47
|
+
|
|
48
|
+
Extends `maplibregl.Map`. Accepts `GeoloniaMapOptions`.
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
const map = new GeoloniaMap({
|
|
52
|
+
container: '#map', // HTMLElement or CSS selector
|
|
53
|
+
apiKey: 'YOUR-API-KEY', // Geolonia API key
|
|
54
|
+
style: 'geolonia/basic-v2', // Style name or URL
|
|
55
|
+
center: [139.77, 35.68], // [lng, lat]
|
|
56
|
+
zoom: 12,
|
|
57
|
+
|
|
58
|
+
// All optional
|
|
59
|
+
lang: 'auto', // 'ja' | 'en' | 'auto'
|
|
60
|
+
stage: 'v1', // 'dev' | 'v1'
|
|
61
|
+
marker: true, // Show default marker at center
|
|
62
|
+
markerColor: '#E4402F',
|
|
63
|
+
openPopup: false, // Auto-open marker popup
|
|
64
|
+
customMarker: '#my-marker', // CSS selector for custom marker element
|
|
65
|
+
customMarkerOffset: [0, -15],
|
|
66
|
+
loader: true, // Loading animation
|
|
67
|
+
gestureHandling: true, // Gesture control on scrollable pages
|
|
68
|
+
navigationControl: true, // true | false | 'top-right' etc.
|
|
69
|
+
geolocateControl: false,
|
|
70
|
+
fullscreenControl: false,
|
|
71
|
+
scaleControl: false,
|
|
72
|
+
geoloniaControl: true, // Geolonia logo
|
|
73
|
+
geojson: 'https://example.com/data.geojson',
|
|
74
|
+
cluster: true,
|
|
75
|
+
clusterColor: '#ff0000',
|
|
76
|
+
simpleVector: 'my-tileset', // Vector tile URL or tileset ID
|
|
77
|
+
'3d': false,
|
|
78
|
+
});
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### `GeoloniaMarker`
|
|
82
|
+
|
|
83
|
+
Extends `maplibregl.Marker` with Geolonia's default marker style.
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
import { GeoloniaMarker } from '@geolonia/maps-core';
|
|
87
|
+
|
|
88
|
+
new GeoloniaMarker({ color: '#0066FF' })
|
|
89
|
+
.setLngLat([139.77, 35.68])
|
|
90
|
+
.addTo(map);
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### `SimpleStyle`
|
|
94
|
+
|
|
95
|
+
GeoJSON visualization based on [simplestyle-spec](https://github.com/mapbox/simplestyle-spec).
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
import { SimpleStyle } from '@geolonia/maps-core';
|
|
99
|
+
|
|
100
|
+
const ss = new SimpleStyle(geojson, { cluster: true });
|
|
101
|
+
ss.addTo(map).fitBounds();
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### `keyring`
|
|
105
|
+
|
|
106
|
+
API key and stage management.
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
import { keyring } from '@geolonia/maps-core';
|
|
110
|
+
|
|
111
|
+
keyring.setApiKey('YOUR-API-KEY');
|
|
112
|
+
keyring.setStage('v1');
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Related Packages
|
|
116
|
+
|
|
117
|
+
| Package | Description |
|
|
118
|
+
|---------|-------------|
|
|
119
|
+
| `@geolonia/maps-embed` | HTML `data-*` attribute map embedding |
|
|
120
|
+
| `@geolonia/maps-react` | React components |
|
|
121
|
+
|
|
122
|
+
## Development
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
npm install
|
|
126
|
+
npm run build # ESM + CJS + DTS
|
|
127
|
+
npm run test # Vitest unit tests
|
|
128
|
+
npm run e2e # Playwright E2E tests
|
|
129
|
+
npm run lint # Biome
|
|
130
|
+
npm run dev # Vite dev server (example/)
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## License
|
|
134
|
+
|
|
135
|
+
MIT
|