@meridian-ts/stadia 0.0.0-stage → 1.0.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/CHANGELOG.md +24 -0
- package/LICENSE.md +21 -0
- package/NOTICE +9 -0
- package/README.md +36 -2
- package/dist/index.d.ts +10 -0
- package/dist/index.js +56 -0
- package/dist/index.js.map +1 -0
- package/package.json +51 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# @meridian-ts/stadia
|
|
2
|
+
|
|
3
|
+
## 1.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 21c5e38: Meridian 1.0: maps and locations for Ember.
|
|
8
|
+
|
|
9
|
+
- `@meridian-ts/ember`: a declarative MapLibre map, a port of `@vis.gl/react-maplibre`. Sources,
|
|
10
|
+
layers, markers, popups, all the controls, clusters, place autocomplete, a geocoder control
|
|
11
|
+
and directions.
|
|
12
|
+
- `@meridian-ts/core`: the provider interfaces for geocoding, places, routing, elevation, time
|
|
13
|
+
zone, static maps and IP location, and `defineMeridian`.
|
|
14
|
+
- Eleven provider adapters: Nominatim, Photon, Pelias, Valhalla, Stadia Maps, MapTiler, Mapbox,
|
|
15
|
+
Google, HERE, Esri and AWS.
|
|
16
|
+
- `@meridian-ts/draw`: draw and edit tools on terra-draw.
|
|
17
|
+
- `@meridian-ts/deck`: deck.gl layers and H3 hexagon clusters.
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies [21c5e38]
|
|
22
|
+
- @meridian-ts/core@1.0.0
|
|
23
|
+
- @meridian-ts/pelias@1.0.0
|
|
24
|
+
- @meridian-ts/valhalla@1.0.0
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Joe Gaudet
|
|
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/NOTICE
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
Meridian
|
|
2
|
+
Copyright (c) 2026 Joe Gaudet. MIT licensed; see LICENSE.md.
|
|
3
|
+
|
|
4
|
+
Meridian is a port of the component API of @vis.gl/react-maplibre (vis.gl contributors, MIT) to
|
|
5
|
+
Ember. It copies the names and the behaviour of that API, and no code.
|
|
6
|
+
|
|
7
|
+
Meridian renders maps with MapLibre GL JS (BSD-3-Clause), which the application installs.
|
|
8
|
+
Each provider adapter calls the public HTTP API of its provider. Meridian depends on no provider
|
|
9
|
+
SDK. The terms of each provider apply to the data that its API returns.
|
package/README.md
CHANGED
|
@@ -1,3 +1,37 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @meridian-ts/stadia
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The Meridian adapter for Stadia Maps. See the [guide](https://joegaudet.com/meridian/).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import { defineMeridian } from '@meridian-ts/core'
|
|
7
|
+
import { stadia } from '@meridian-ts/stadia'
|
|
8
|
+
|
|
9
|
+
const provider = stadia({ apiKey: 'YOUR_KEY' })
|
|
10
|
+
export const meridian = defineMeridian({
|
|
11
|
+
geocoding: provider,
|
|
12
|
+
places: provider,
|
|
13
|
+
routing: provider,
|
|
14
|
+
elevation: provider,
|
|
15
|
+
timezone: provider,
|
|
16
|
+
staticMap: provider,
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
const places = await meridian.geocoding.forward('Stanley Park, Vancouver')
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
The provider sends the key as the `api_key` query parameter. To keep the key on your server,
|
|
23
|
+
pass the URL of your proxy as `baseUrl`: the adapter then sends no key.
|
|
24
|
+
|
|
25
|
+
Geocoding and places use the hosted Pelias, and routing and elevation use the hosted
|
|
26
|
+
Valhalla. The place functions search the `venue` layer and ignore `categories`.
|
|
27
|
+
|
|
28
|
+
**Warning:** without `baseUrl`, the URL that `staticMap.url` gives contains the key. Use a key that you restricted at the provider, or a proxy.
|
|
29
|
+
|
|
30
|
+
A proxy must send the path without change. It must not decode `%2F` in a path.
|
|
31
|
+
|
|
32
|
+
The adapter uses two hosts. With `baseUrl`, the two go to your proxy with the same paths:
|
|
33
|
+
|
|
34
|
+
| Path | Host |
|
|
35
|
+
| ----------------------------------------------------------------------------------------------- | ---------------------- |
|
|
36
|
+
| `/geocoding/v1/…`, `/route/v1`, `/isochrone/v1`, `/matrix/v1`, `/elevation/v1`, `/tz/lookup/v1` | `api.stadiamaps.com` |
|
|
37
|
+
| `/static/…` | `tiles.stadiamaps.com` |
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type AdapterOptions, type Provider } from '@meridian-ts/core';
|
|
2
|
+
export interface StadiaOptions extends AdapterOptions {
|
|
3
|
+
/** The API key. A browser on a domain that you registered with Stadia Maps needs no key. */
|
|
4
|
+
apiKey?: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* The Stadia Maps adapter. Geocoding and places are hosted Pelias, and routing and elevation
|
|
8
|
+
* are hosted Valhalla. It also has the time zone lookup and static maps.
|
|
9
|
+
*/
|
|
10
|
+
export declare function stadia(options?: StadiaOptions): Provider;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { createHttp, stylePath, toLngLat } from '@meridian-ts/core';
|
|
2
|
+
import { peliasGeocoding } from '@meridian-ts/pelias';
|
|
3
|
+
import { valhallaElevation, valhallaRouting } from '@meridian-ts/valhalla';
|
|
4
|
+
|
|
5
|
+
// src/index.ts
|
|
6
|
+
var latLon = (value) => {
|
|
7
|
+
const [lng, lat] = toLngLat(value);
|
|
8
|
+
return `${lat},${lng}`;
|
|
9
|
+
};
|
|
10
|
+
function stadia(options = {}) {
|
|
11
|
+
const key = { param: "api_key", value: options.apiKey };
|
|
12
|
+
const http = createHttp({
|
|
13
|
+
provider: "stadia",
|
|
14
|
+
defaultBaseUrl: "https://api.stadiamaps.com",
|
|
15
|
+
key,
|
|
16
|
+
options
|
|
17
|
+
});
|
|
18
|
+
const tiles = createHttp({
|
|
19
|
+
provider: "stadia",
|
|
20
|
+
defaultBaseUrl: "https://tiles.stadiamaps.com",
|
|
21
|
+
key,
|
|
22
|
+
options
|
|
23
|
+
});
|
|
24
|
+
return {
|
|
25
|
+
name: "stadia",
|
|
26
|
+
...peliasGeocoding(http, "/geocoding/v1"),
|
|
27
|
+
routing: valhallaRouting(http, {
|
|
28
|
+
route: "/route/v1",
|
|
29
|
+
isochrone: "/isochrone/v1",
|
|
30
|
+
matrix: "/matrix/v1"
|
|
31
|
+
}),
|
|
32
|
+
elevation: valhallaElevation(http, "/elevation/v1"),
|
|
33
|
+
timezone: {
|
|
34
|
+
at: async (lngLat, o = {}) => {
|
|
35
|
+
const [lng, lat] = toLngLat(lngLat);
|
|
36
|
+
const body = await http.get("/tz/lookup/v1", { lat, lng }, o);
|
|
37
|
+
return body.tz_id;
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
staticMap: {
|
|
41
|
+
url: (o) => {
|
|
42
|
+
const url = tiles.url(`/static/${stylePath(o.style ?? "alidade_smooth")}.png`, {
|
|
43
|
+
size: `${o.width}x${o.height}${o.scale === 2 ? "@2x" : ""}`,
|
|
44
|
+
center: latLon(o.center),
|
|
45
|
+
zoom: o.zoom
|
|
46
|
+
});
|
|
47
|
+
const markers = (o.markers ?? []).map((m) => `&m=${encodeURIComponent(latLon(m))}`);
|
|
48
|
+
return url + markers.join("");
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export { stadia };
|
|
55
|
+
//# sourceMappingURL=index.js.map
|
|
56
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAqBA,IAAM,MAAA,GAAS,CAAC,KAAA,KAAsB;AACpC,EAAA,MAAM,CAAC,GAAA,EAAK,GAAG,CAAA,GAAI,SAAS,KAAK,CAAA;AACjC,EAAA,OAAO,CAAA,EAAG,GAAG,CAAA,CAAA,EAAI,GAAG,CAAA,CAAA;AACtB,CAAA;AAMO,SAAS,MAAA,CAAO,OAAA,GAAyB,EAAC,EAAa;AAC5D,EAAA,MAAM,MAAM,EAAE,KAAA,EAAO,SAAA,EAAW,KAAA,EAAO,QAAQ,MAAA,EAAO;AACtD,EAAA,MAAM,OAAO,UAAA,CAAW;AAAA,IACtB,QAAA,EAAU,QAAA;AAAA,IACV,cAAA,EAAgB,4BAAA;AAAA,IAChB,GAAA;AAAA,IACA;AAAA,GACD,CAAA;AAED,EAAA,MAAM,QAAQ,UAA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A;AAED,QAAA,MAAM,OAAA,GAAA,CAAW,CAAA,CAAE,OAAA,IAAW,EAAC,EAAG,GAAA,CAAI,CAAA,CAAA,KAAK,CAAA,GAAA,EAAM,kBAAA,CAAmB,MAAA,CAAO,CAAC,CAAC,CAAC,CAAA,CAAE,CAAA;AAChF,QAAA,OAAO,GAAA,GAAM,OAAA,CAAQ,IAAA,CAAK,EAAE,CAAA;AAAA,MAC9B;AAAA;AACF,GACF;AACF","file":"index.js","sourcesContent":["// Stadia Maps API: https://docs.stadiamaps.com/\n// OpenAPI specification (geocoding, routing, elevation, time zone):\n// https://api.stadiamaps.com/openapi.yaml\n// Static maps: https://docs.stadiamaps.com/static-maps/\n// Authentication: https://docs.stadiamaps.com/authentication/\nimport {\n stylePath,\n createHttp,\n toLngLat,\n type AdapterOptions,\n type LngLatLike,\n type Provider,\n} from '@meridian-ts/core'\nimport { peliasGeocoding } from '@meridian-ts/pelias'\nimport { valhallaElevation, valhallaRouting } from '@meridian-ts/valhalla'\n\nexport interface StadiaOptions extends AdapterOptions {\n /** The API key. A browser on a domain that you registered with Stadia Maps needs no key. */\n apiKey?: string\n}\n\nconst latLon = (value: LngLatLike) => {\n const [lng, lat] = toLngLat(value)\n return `${lat},${lng}`\n}\n\n/**\n * The Stadia Maps adapter. Geocoding and places are hosted Pelias, and routing and elevation\n * are hosted Valhalla. It also has the time zone lookup and static maps.\n */\nexport function stadia(options: StadiaOptions = {}): Provider {\n const key = { param: 'api_key', value: options.apiKey }\n const http = createHttp({\n provider: 'stadia',\n defaultBaseUrl: 'https://api.stadiamaps.com',\n key,\n options,\n })\n // Static maps are on the tile server.\n const tiles = createHttp({\n provider: 'stadia',\n defaultBaseUrl: 'https://tiles.stadiamaps.com',\n key,\n options,\n })\n\n return {\n name: 'stadia',\n ...peliasGeocoding(http, '/geocoding/v1'),\n routing: valhallaRouting(http, {\n route: '/route/v1',\n isochrone: '/isochrone/v1',\n matrix: '/matrix/v1',\n }),\n elevation: valhallaElevation(http, '/elevation/v1'),\n timezone: {\n at: async (lngLat, o = {}) => {\n const [lng, lat] = toLngLat(lngLat)\n const body = await http.get<{ tz_id: string }>('/tz/lookup/v1', { lat, lng }, o)\n return body.tz_id\n },\n },\n staticMap: {\n url: o => {\n const url = tiles.url(`/static/${stylePath(o.style ?? 'alidade_smooth')}.png`, {\n size: `${o.width}x${o.height}${o.scale === 2 ? '@2x' : ''}`,\n center: latLon(o.center),\n zoom: o.zoom,\n })\n // The `m` parameter occurs one time for each marker, so it cannot be in the query object.\n const markers = (o.markers ?? []).map(m => `&m=${encodeURIComponent(latLon(m))}`)\n return url + markers.join('')\n },\n },\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,54 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meridian-ts/stadia",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Meridian adapter for Stadia Maps: geocoding, routing, elevation, time zone and static maps.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"meridian",
|
|
7
|
+
"stadia",
|
|
8
|
+
"geocoding routing stadiamaps",
|
|
9
|
+
"gis"
|
|
10
|
+
],
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"author": "Joe Gaudet joe@joegaudet.com",
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/joegaudet/meridian.git",
|
|
16
|
+
"directory": "packages/stadia"
|
|
17
|
+
},
|
|
18
|
+
"homepage": "https://joegaudet.com/meridian/",
|
|
19
|
+
"bugs": "https://github.com/joegaudet/meridian/issues",
|
|
20
|
+
"type": "module",
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"default": "./dist/index.js"
|
|
26
|
+
},
|
|
27
|
+
"./package.json": "./package.json"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"dist",
|
|
31
|
+
"CHANGELOG.md",
|
|
32
|
+
"README.md",
|
|
33
|
+
"LICENSE.md",
|
|
34
|
+
"NOTICE"
|
|
35
|
+
],
|
|
36
|
+
"sideEffects": false,
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@meridian-ts/core": "^1.0.0",
|
|
39
|
+
"@meridian-ts/pelias": "^1.0.0",
|
|
40
|
+
"@meridian-ts/valhalla": "^1.0.0"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@meridian-ts/conformance": "0.0.0"
|
|
44
|
+
},
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"access": "public"
|
|
47
|
+
},
|
|
48
|
+
"engines": {
|
|
49
|
+
"node": ">=22.12.0"
|
|
50
|
+
},
|
|
51
|
+
"scripts": {
|
|
52
|
+
"build": "tsup"
|
|
53
|
+
}
|
|
6
54
|
}
|