@meridian-ts/maptiler 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 ADDED
@@ -0,0 +1,22 @@
1
+ # @meridian-ts/maptiler
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
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,29 @@
1
- # Temporary Holding Version
1
+ # @meridian-ts/maptiler
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The Meridian adapter for MapTiler. See the [guide](https://joegaudet.com/meridian/).
4
+
5
+ ```ts
6
+ import { defineMeridian } from '@meridian-ts/core'
7
+ import { maptiler } from '@meridian-ts/maptiler'
8
+
9
+ const provider = maptiler({ apiKey: 'YOUR_MAPTILER_API_KEY' })
10
+
11
+ export const meridian = defineMeridian({
12
+ geocoding: provider,
13
+ elevation: provider,
14
+ staticMap: provider,
15
+ ipLocation: provider,
16
+ })
17
+
18
+ const places = await meridian.geocoding.forward('Zurich')
19
+ ```
20
+
21
+ The provider needs an API key. To keep the key on your server, pass `baseUrl` with the URL of
22
+ your proxy, and omit `apiKey`.
23
+
24
+ To restrict the key, set the allowed HTTP origins of the key in your
25
+ [MapTiler account](https://docs.maptiler.com/guides/developer/credentials/api-key/#secure-key).
26
+
27
+ **Warning:** without `baseUrl`, the URL that `staticMap.url` gives contains the key. Use a key that you restricted at the provider, or a proxy.
28
+
29
+ A proxy must send the path without change. It must not decode `%2F` in a path.
@@ -0,0 +1,9 @@
1
+ import { type AdapterOptions, type Provider } from '@meridian-ts/core';
2
+ export interface MaptilerOptions extends AdapterOptions {
3
+ /** The MapTiler API key. Omit it when `baseUrl` is your proxy. */
4
+ apiKey?: string;
5
+ }
6
+ /**
7
+ * The MapTiler adapter: geocoding, elevation, static maps and IP location.
8
+ */
9
+ export declare function maptiler(options?: MaptilerOptions): Provider;
package/dist/index.js ADDED
@@ -0,0 +1,120 @@
1
+ import { createHttp, toLngLat, stylePath } from '@meridian-ts/core';
2
+
3
+ // src/index.ts
4
+ function toPlace(feature) {
5
+ const [lng, lat] = feature.center;
6
+ const parts = [feature, ...feature.context ?? []];
7
+ const part = (type) => parts.find((p) => p.id.startsWith(`${type}.`))?.text;
8
+ const place = {
9
+ id: feature.id,
10
+ name: feature.text,
11
+ label: feature.place_name,
12
+ location: { lat, lng },
13
+ address: {
14
+ houseNumber: feature.address,
15
+ street: part("address") ?? part("road"),
16
+ district: part("neighbourhood") ?? part("municipal_district"),
17
+ city: part("municipality"),
18
+ county: part("county"),
19
+ region: part("region"),
20
+ postcode: part("postal_code"),
21
+ country: part("country"),
22
+ countryCode: feature.properties?.country_code?.toUpperCase()
23
+ },
24
+ raw: feature
25
+ };
26
+ if (feature.bbox) place.bbox = feature.bbox;
27
+ const categories = feature.properties?.categories ?? feature.place_type;
28
+ if (categories) place.categories = categories;
29
+ return place;
30
+ }
31
+ var toLanguage = (language) => language?.split("-")[0];
32
+ function maptiler(options = {}) {
33
+ const http = createHttp({
34
+ provider: "maptiler",
35
+ defaultBaseUrl: "https://api.maptiler.com",
36
+ key: { param: "key", value: options.apiKey },
37
+ options
38
+ });
39
+ const search = (autocomplete) => async (query, o = {}) => {
40
+ const body = await http.get(
41
+ // The query is one path segment. A `;` without the encoding starts a batch request.
42
+ `/geocoding/${encodeURIComponent(query)}.json`,
43
+ {
44
+ autocomplete,
45
+ limit: o.limit,
46
+ language: toLanguage(o.language),
47
+ proximity: o.proximity && toLngLat(o.proximity).join(","),
48
+ bbox: o.bbox?.join(","),
49
+ country: o.countries?.join(",").toLowerCase()
50
+ },
51
+ o
52
+ );
53
+ return body.features.map(toPlace);
54
+ };
55
+ return {
56
+ name: "maptiler",
57
+ geocoding: {
58
+ forward: search(false),
59
+ autocomplete: search(true),
60
+ reverse: async (lngLat, o = {}) => {
61
+ const body = await http.get(
62
+ `/geocoding/${toLngLat(lngLat).join(",")}.json`,
63
+ { language: toLanguage(o.language) },
64
+ o
65
+ );
66
+ return body.features.slice(0, o.limit).map(toPlace);
67
+ }
68
+ },
69
+ elevation: {
70
+ // shortcut: one request, and MapTiler accepts 50 positions. Add batches for more.
71
+ at: async (lngLats, o = {}) => {
72
+ const locations = lngLats.map((lngLat) => toLngLat(lngLat).join(",")).join(";");
73
+ const rows = await http.get(
74
+ `/elevation/${locations}.json`,
75
+ {},
76
+ o
77
+ );
78
+ return rows.map((row) => row[2]);
79
+ }
80
+ },
81
+ staticMap: {
82
+ url: (o) => {
83
+ const center = toLngLat(o.center).join(",");
84
+ const size = `${o.width}x${o.height}${o.scale === 2 ? "@2x" : ""}`;
85
+ return http.url(
86
+ `/maps/${stylePath(o.style ?? "streets-v4")}/static/${center},${o.zoom}/${size}.png`,
87
+ {
88
+ markers: o.markers?.map((marker) => toLngLat(marker).join(",")).join("|")
89
+ }
90
+ );
91
+ }
92
+ },
93
+ ipLocation: {
94
+ locate: async (o = {}) => {
95
+ const body = await http.get("/geolocation/ip.json", {}, o);
96
+ const name = body.city ?? body.region ?? body.country ?? "";
97
+ return {
98
+ // MapTiler gives no id for an IP location.
99
+ id: `${body.longitude},${body.latitude}`,
100
+ name,
101
+ label: [.../* @__PURE__ */ new Set([name, body.country])].filter(Boolean).join(", "),
102
+ location: { lat: body.latitude, lng: body.longitude },
103
+ address: {
104
+ city: body.city,
105
+ region: body.region,
106
+ regionCode: body.region_code,
107
+ postcode: body.postal,
108
+ country: body.country,
109
+ countryCode: body.country_code?.toUpperCase()
110
+ },
111
+ raw: body
112
+ };
113
+ }
114
+ }
115
+ };
116
+ }
117
+
118
+ export { maptiler };
119
+ //# sourceMappingURL=index.js.map
120
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;AAsDA,SAAS,QAAQ,OAAA,EAAiC;AAChD,EAAA,MAAM,CAAC,GAAA,EAAK,GAAG,CAAA,GAAI,OAAA,CAAQ,MAAA;AAE3B,EAAA,MAAM,QAAQ,CAAC,OAAA,EAAS,GAAI,OAAA,CAAQ,OAAA,IAAW,EAAG,CAAA;AAClD,EAAA,MAAM,IAAA,GAAO,CAAC,IAAA,KAAiB,KAAA,CAAM,IAAA,CAAK,CAAA,CAAA,KAAK,CAAA,CAAE,EAAA,CAAG,UAAA,CAAW,CAAA,EAAG,IAAI,CAAA,CAAA,CAAG,CAAC,CAAA,EAAG,IAAA;AAC7E,EAAA,MAAM,KAAA,GAAe;AAAA,IACnB,IAAI,OAAA,CAAQ,EAAA;AAAA,IACZ,MAAM,OAAA,CAAQ,IAAA;AAAA,IACd,OAAO,OAAA,CAAQ,UAAA;AAAA,IACf,QAAA,EAAU,EAAE,GAAA,EAAK,GAAA,EAAI;AAAA,IACrB,OAAA,EAAS;AAAA,MACP,aAAa,OAAA,CAAQ,OAAA;AAAA,MACrB,MAAA,EAAQ,IAAA,CAAK,SAAS,CAAA,IAAK,KAAK,MAAM,CAAA;AAAA,MACtC,QAAA,EAAU,IAAA,CAAK,eAAe,CAAA,IAAK,KAAK,oBAAoB,CAAA;AAAA,MAC5D,IAAA,EAAM,KAAK,cAAc,CAAA;AAAA,MACzB,MAAA,EAAQ,KAAK,QAAQ,CAAA;AAAA,MACrB,MAAA,EAAQ,KAAK,QAAQ,CAAA;AAAA,MACrB,QAAA,EAAU,KAAK,aAAa,CAAA;AAAA,MAC5B,OAAA,EAAS,KAAK,SAAS,CAAA;AAAA,MACvB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AK,OAAO,CAAC,CAAC,CAAA,CAAE,MAAA,CAAO,OAAO,CAAA,CAAE,KAAK,IAAI,CAAA;AAAA,UACnE,UAAU,EAAE,GAAA,EAAK,KAAK,QAAA,EAAU,GAAA,EAAK,KAAK,SAAA,EAAU;AAAA,UACpD,OAAA,EAAS;AAAA,YACP,MAAM,IAAA,CAAK,IAAA;AAAA,YACX,QAAQ,IAAA,CAAK,MAAA;AAAA,YACb,YAAY,IAAA,CAAK,WAAA;AAAA,YACjB,UAAU,IAAA,CAAK,MAAA;AAAA,YACf,SAAS,IAAA,CAAK,OAAA;AAAA,YACd,WAAA,EAAa,IAAA,CAAK,YAAA,EAAc,WAAA;AAAY,WAC9C;AAAA,UACA,GAAA,EAAK;AAAA,SACP;AAAA,MACF;AAAA;AACF,GACF;AACF","file":"index.js","sourcesContent":["// MapTiler Cloud API. The request and the response of each function come from these pages:\n// Geocoding: https://docs.maptiler.com/cloud/api/geocoding/\n// Elevation: https://docs.maptiler.com/cloud/api/elevation/\n// Static maps: https://docs.maptiler.com/cloud/api/static-maps/\n// Geolocation: https://docs.maptiler.com/cloud/api/geolocation/\nimport {\n stylePath,\n createHttp,\n toLngLat,\n type AdapterOptions,\n type BBox,\n type GeocodeOptions,\n type Place,\n type Provider,\n} from '@meridian-ts/core'\n\nexport interface MaptilerOptions extends AdapterOptions {\n /** The MapTiler API key. Omit it when `baseUrl` is your proxy. */\n apiKey?: string\n}\n\n/** The fields that a feature and each item of its `context` have. */\ninterface MaptilerPart {\n /** The place type, a period and a number, for example `municipality.46425`. */\n id: string\n text: string\n}\n\ninterface MaptilerFeature extends MaptilerPart {\n properties?: { country_code?: string; categories?: string[] }\n center: [number, number]\n bbox?: BBox\n place_name: string\n place_type?: string[]\n context?: MaptilerPart[]\n /** The address number. */\n address?: string\n}\n\ninterface MaptilerResult {\n features: MaptilerFeature[]\n}\n\ninterface MaptilerIpLocation {\n country?: string\n country_code?: string\n city?: string\n latitude: number\n longitude: number\n postal?: string\n region?: string\n region_code?: string\n}\n\nfunction toPlace(feature: MaptilerFeature): Place {\n const [lng, lat] = feature.center\n // The feature is a part of its own address: a `municipality` feature is the city.\n const parts = [feature, ...(feature.context ?? [])]\n const part = (type: string) => parts.find(p => p.id.startsWith(`${type}.`))?.text\n const place: Place = {\n id: feature.id,\n name: feature.text,\n label: feature.place_name,\n location: { lat, lng },\n address: {\n houseNumber: feature.address,\n street: part('address') ?? part('road'),\n district: part('neighbourhood') ?? part('municipal_district'),\n city: part('municipality'),\n county: part('county'),\n region: part('region'),\n postcode: part('postal_code'),\n country: part('country'),\n countryCode: feature.properties?.country_code?.toUpperCase(),\n },\n raw: feature,\n }\n if (feature.bbox) place.bbox = feature.bbox\n const categories = feature.properties?.categories ?? feature.place_type\n if (categories) place.categories = categories\n return place\n}\n\n/** MapTiler accepts only ISO 639-1 codes, so `en-GB` becomes `en`. */\nconst toLanguage = (language?: string) => language?.split('-')[0]\n\n/**\n * The MapTiler adapter: geocoding, elevation, static maps and IP location.\n */\nexport function maptiler(options: MaptilerOptions = {}): Provider {\n const http = createHttp({\n provider: 'maptiler',\n defaultBaseUrl: 'https://api.maptiler.com',\n key: { param: 'key', value: options.apiKey },\n options,\n })\n\n const search =\n (autocomplete: boolean) =>\n async (query: string, o: GeocodeOptions = {}): Promise<Place[]> => {\n const body = await http.get<MaptilerResult>(\n // The query is one path segment. A `;` without the encoding starts a batch request.\n `/geocoding/${encodeURIComponent(query)}.json`,\n {\n autocomplete,\n limit: o.limit,\n language: toLanguage(o.language),\n proximity: o.proximity && toLngLat(o.proximity).join(','),\n bbox: o.bbox?.join(','),\n country: o.countries?.join(',').toLowerCase(),\n },\n o,\n )\n return body.features.map(toPlace)\n }\n\n return {\n name: 'maptiler',\n geocoding: {\n forward: search(false),\n autocomplete: search(true),\n reverse: async (lngLat, o = {}) => {\n const body = await http.get<MaptilerResult>(\n `/geocoding/${toLngLat(lngLat).join(',')}.json`,\n { language: toLanguage(o.language) },\n o,\n )\n // MapTiler accepts a `limit` larger than 1 only with one `types` value, so the adapter\n // applies the limit to the results.\n return body.features.slice(0, o.limit).map(toPlace)\n },\n },\n elevation: {\n // shortcut: one request, and MapTiler accepts 50 positions. Add batches for more.\n at: async (lngLats, o = {}) => {\n const locations = lngLats.map(lngLat => toLngLat(lngLat).join(',')).join(';')\n const rows = await http.get<[lng: number, lat: number, metres: number][]>(\n `/elevation/${locations}.json`,\n {},\n o,\n )\n return rows.map(row => row[2])\n },\n },\n staticMap: {\n url: o => {\n const center = toLngLat(o.center).join(',')\n const size = `${o.width}x${o.height}${o.scale === 2 ? '@2x' : ''}`\n return http.url(\n `/maps/${stylePath(o.style ?? 'streets-v4')}/static/${center},${o.zoom}/${size}.png`,\n {\n markers: o.markers?.map(marker => toLngLat(marker).join(',')).join('|'),\n },\n )\n },\n },\n ipLocation: {\n locate: async (o = {}) => {\n const body = await http.get<MaptilerIpLocation>('/geolocation/ip.json', {}, o)\n const name = body.city ?? body.region ?? body.country ?? ''\n return {\n // MapTiler gives no id for an IP location.\n id: `${body.longitude},${body.latitude}`,\n name,\n label: [...new Set([name, body.country])].filter(Boolean).join(', '),\n location: { lat: body.latitude, lng: body.longitude },\n address: {\n city: body.city,\n region: body.region,\n regionCode: body.region_code,\n postcode: body.postal,\n country: body.country,\n countryCode: body.country_code?.toUpperCase(),\n },\n raw: body,\n }\n },\n },\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,52 @@
1
1
  {
2
2
  "name": "@meridian-ts/maptiler",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "1.0.0",
4
+ "description": "Meridian adapter for MapTiler: geocoding, elevation, static maps and IP location.",
5
+ "keywords": [
6
+ "meridian",
7
+ "maptiler",
8
+ "geocoding static-maps",
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/maptiler"
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
+ },
40
+ "devDependencies": {
41
+ "@meridian-ts/conformance": "0.0.0"
42
+ },
43
+ "publishConfig": {
44
+ "access": "public"
45
+ },
46
+ "engines": {
47
+ "node": ">=22.12.0"
48
+ },
49
+ "scripts": {
50
+ "build": "tsup"
51
+ }
6
52
  }