@meridian-ts/nominatim 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 +22 -0
- package/LICENSE.md +21 -0
- package/NOTICE +9 -0
- package/README.md +13 -2
- package/dist/index.d.ts +12 -0
- package/dist/index.js +74 -0
- package/dist/index.js.map +1 -0
- package/package.json +49 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# @meridian-ts/nominatim
|
|
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,14 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @meridian-ts/nominatim
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The Meridian adapter for Nominatim. See the [guide](https://joegaudet.com/meridian/).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import { defineMeridian } from '@meridian-ts/core'
|
|
7
|
+
import { nominatim } from '@meridian-ts/nominatim'
|
|
8
|
+
|
|
9
|
+
export const meridian = defineMeridian({ geocoding: nominatim() })
|
|
10
|
+
|
|
11
|
+
const places = await meridian.geocoding.forward('Stanley Park, Vancouver')
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
The provider needs no key. To use your own server or a proxy, pass `baseUrl`.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type AdapterOptions, type Provider } from '@meridian-ts/core';
|
|
2
|
+
export interface NominatimOptions extends AdapterOptions {
|
|
3
|
+
/** The public server asks for a contact address in each request. */
|
|
4
|
+
email?: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* The Nominatim adapter: forward and reverse geocoding.
|
|
8
|
+
*
|
|
9
|
+
* It has no `autocomplete`: the usage policy of the public server does not permit
|
|
10
|
+
* search-as-you-type. Use Photon for that.
|
|
11
|
+
*/
|
|
12
|
+
export declare function nominatim(options?: NominatimOptions): Provider;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { createHttp, toLngLat } from '@meridian-ts/core';
|
|
2
|
+
|
|
3
|
+
// src/index.ts
|
|
4
|
+
function toPlace(result) {
|
|
5
|
+
const a = result.address ?? {};
|
|
6
|
+
const place = {
|
|
7
|
+
id: result.osm_type ? `${result.osm_type[0].toUpperCase()}${result.osm_id}` : String(result.place_id),
|
|
8
|
+
name: result.name || result.display_name.split(",")[0],
|
|
9
|
+
label: result.display_name,
|
|
10
|
+
location: { lat: Number(result.lat), lng: Number(result.lon) },
|
|
11
|
+
address: {
|
|
12
|
+
houseNumber: a.house_number,
|
|
13
|
+
street: a.road,
|
|
14
|
+
district: a.suburb ?? a.neighbourhood,
|
|
15
|
+
city: a.city ?? a.town ?? a.village ?? a.municipality,
|
|
16
|
+
county: a.county,
|
|
17
|
+
region: a.state,
|
|
18
|
+
regionCode: a["ISO3166-2-lvl4"],
|
|
19
|
+
postcode: a.postcode,
|
|
20
|
+
country: a.country,
|
|
21
|
+
countryCode: a.country_code?.toUpperCase()
|
|
22
|
+
},
|
|
23
|
+
raw: result
|
|
24
|
+
};
|
|
25
|
+
if (result.boundingbox) {
|
|
26
|
+
const [south, north, west, east] = result.boundingbox.map(Number);
|
|
27
|
+
place.bbox = [west, south, east, north];
|
|
28
|
+
}
|
|
29
|
+
if (result.category) place.categories = [`${result.category}:${result.type}`];
|
|
30
|
+
return place;
|
|
31
|
+
}
|
|
32
|
+
function nominatim(options = {}) {
|
|
33
|
+
const http = createHttp({
|
|
34
|
+
provider: "nominatim",
|
|
35
|
+
defaultBaseUrl: "https://nominatim.openstreetmap.org",
|
|
36
|
+
options
|
|
37
|
+
});
|
|
38
|
+
const common = { format: "jsonv2", addressdetails: 1, email: options.email };
|
|
39
|
+
return {
|
|
40
|
+
name: "nominatim",
|
|
41
|
+
geocoding: {
|
|
42
|
+
forward: async (query, o = {}) => {
|
|
43
|
+
const results = await http.get(
|
|
44
|
+
"/search",
|
|
45
|
+
{
|
|
46
|
+
q: query,
|
|
47
|
+
...common,
|
|
48
|
+
limit: o.limit,
|
|
49
|
+
"accept-language": o.language,
|
|
50
|
+
countrycodes: o.countries?.join(",").toLowerCase(),
|
|
51
|
+
// `left,top,right,bottom`
|
|
52
|
+
viewbox: o.bbox && [o.bbox[0], o.bbox[3], o.bbox[2], o.bbox[1]].join(","),
|
|
53
|
+
bounded: o.bbox ? 1 : void 0
|
|
54
|
+
},
|
|
55
|
+
o
|
|
56
|
+
);
|
|
57
|
+
return results.map(toPlace);
|
|
58
|
+
},
|
|
59
|
+
reverse: async (lngLat, o = {}) => {
|
|
60
|
+
const [lon, lat] = toLngLat(lngLat);
|
|
61
|
+
const result = await http.get(
|
|
62
|
+
"/reverse",
|
|
63
|
+
{ lat, lon, ...common, "accept-language": o.language },
|
|
64
|
+
o
|
|
65
|
+
);
|
|
66
|
+
return result.error ? [] : [toPlace(result)];
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export { nominatim };
|
|
73
|
+
//# sourceMappingURL=index.js.map
|
|
74
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;AA+BA,SAAS,QAAQ,MAAA,EAAgC;AAC/C,EAAA,MAAM,CAAA,GAAI,MAAA,CAAO,OAAA,IAAW,EAAC;AAC7B,EAAA,MAAM,KAAA,GAAe;AAAA,IACnB,IAAI,MAAA,CAAO,QAAA,GACP,CAAA,EAAG,MAAA,CAAO,SAAS,CAAC,CAAA,CAAG,WAAA,EAAa,GAAG,MAAA,CAAO,MAAM,CAAA,CAAA,GACpD,MAAA,CAAO,OAAO,QAAQ,CAAA;AAAA,IAC1B,IAAA,EAAM,OAAO,IAAA,IAAQ,MAAA,CAAO,aAAa,KAAA,CAAM,GAAG,EAAE,CAAC,CAAA;AAAA,IACrD,OAAO,MAAA,CAAO,YAAA;AAAA,IACd,QAAA,EAAU,EAAE,GAAA,EAAK,MAAA,CAAO,MAAA,CAAO,GAAG,CAAA,EAAG,GAAA,EAAK,MAAA,CAAO,MAAA,CAAO,GAAG,CAAA,EAAE;AAAA,IAC7D,OAAA,EAAS;AAAA,MACP,aAAa,CAAA,CAAE,YAAA;AAAA,MACf,QAAQ,CAAA,CAAE,IAAA;AAAA,MACV,QAAA,EAAU,CAAA,CAAE,MAAA,IAAU,CAAA,CAAE,aAAA;AAAA,MACxB,MAAM,CAAA,CAAE,IAAA,IAAQ,EAAE,IAAA,IAAQ,CAAA,CAAE,WAAW,CAAA,CAAE,YAAA;AAAA,MACzC,QAAQ,CAAA,CAAE,MAAA;AAAA,MACV,QAAQ,CAAA,CAAE,KAAA;AAAA,MACV,UAAA,EAAY,EA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T,mBAAmB,CAAA,CAAE,QAAA;AAAA,YACrB,cAAc,CAAA,CAAE,SAAA,EAAW,IAAA,CAAK,GAAG,EAAE,WAAA,EAAY;AAAA;AAAA,YAEjD,OAAA,EAAS,EAAE,IAAA,IAAQ,CAAC,EAAE,IAAA,CAAK,CAAC,CAAA,EAAG,CAAA,CAAE,IAAA,CAAK,CAAC,GAAG,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,EAAG,CAAA,CAAE,KAAK,CAAC,CAAC,CAAA,CAAE,IAAA,CAAK,GAAG,CAAA;AAAA,YACxE,OAAA,EAAS,CAAA,CAAE,IAAA,GAAO,CAAA,GAAI;AAAA,WACxB;AAAA,UACA;AAAA,SACF;AACA,QAAA,OAAO,OAAA,CAAQ,IAAI,OAAO,CAAA;AAAA,MAC5B,CAAA;AAAA,MACA,OAAA,EAAS,OAAO,MAAA,EAAQ,CAAA,GAAI,EAAC,KAAM;AACjC,QAAA,MAAM,CAAC,GAAA,EAAK,GAAG,CAAA,GAAI,SAAS,MAAM,CAAA;AAClC,QAAA,MAAM,MAAA,GAAS,MAAM,IAAA,CAAK,GAAA;AAAA,UACxB,UAAA;AAAA,UACA,EAAE,GAAA,EAAK,GAAA,EAAK,GAAG,MAAA,EAAQ,iBAAA,EAAmB,EAAE,QAAA,EAAS;AAAA,UACrD;AAAA,SACF;AAEA,QAAA,OAAO,OAAO,KAAA,GAAQ,KAAK,CAAC,OAAA,CAAQ,MAAM,CAAC,CAAA;AAAA,MAC7C;AAAA;AACF,GACF;AACF","file":"index.js","sourcesContent":["// Nominatim API: https://nominatim.org/release-docs/latest/api/Search/ and …/api/Reverse/\n// Usage policy of the public server: https://operations.osmfoundation.org/policies/nominatim/\nimport {\n createHttp,\n toLngLat,\n type AdapterOptions,\n type Place,\n type Provider,\n} from '@meridian-ts/core'\n\nexport interface NominatimOptions extends AdapterOptions {\n /** The public server asks for a contact address in each request. */\n email?: string\n}\n\ninterface NominatimResult {\n osm_type?: string\n osm_id?: number\n place_id: number\n lat: string\n lon: string\n category?: string\n type?: string\n name?: string\n display_name: string\n address?: Record<string, string>\n /** `[south, north, west, east]`, as strings. */\n boundingbox?: [string, string, string, string]\n error?: string\n}\n\nfunction toPlace(result: NominatimResult): Place {\n const a = result.address ?? {}\n const place: Place = {\n id: result.osm_type\n ? `${result.osm_type[0]!.toUpperCase()}${result.osm_id}`\n : String(result.place_id),\n name: result.name || result.display_name.split(',')[0]!,\n label: result.display_name,\n location: { lat: Number(result.lat), lng: Number(result.lon) },\n address: {\n houseNumber: a.house_number,\n street: a.road,\n district: a.suburb ?? a.neighbourhood,\n city: a.city ?? a.town ?? a.village ?? a.municipality,\n county: a.county,\n region: a.state,\n regionCode: a['ISO3166-2-lvl4'],\n postcode: a.postcode,\n country: a.country,\n countryCode: a.country_code?.toUpperCase(),\n },\n raw: result,\n }\n if (result.boundingbox) {\n const [south, north, west, east] = result.boundingbox.map(Number) as [\n number,\n number,\n number,\n number,\n ]\n place.bbox = [west, south, east, north]\n }\n if (result.category) place.categories = [`${result.category}:${result.type}`]\n return place\n}\n\n/**\n * The Nominatim adapter: forward and reverse geocoding.\n *\n * It has no `autocomplete`: the usage policy of the public server does not permit\n * search-as-you-type. Use Photon for that.\n */\nexport function nominatim(options: NominatimOptions = {}): Provider {\n const http = createHttp({\n provider: 'nominatim',\n defaultBaseUrl: 'https://nominatim.openstreetmap.org',\n options,\n })\n const common = { format: 'jsonv2', addressdetails: 1, email: options.email }\n\n return {\n name: 'nominatim',\n geocoding: {\n forward: async (query, o = {}) => {\n const results = await http.get<NominatimResult[]>(\n '/search',\n {\n q: query,\n ...common,\n limit: o.limit,\n 'accept-language': o.language,\n countrycodes: o.countries?.join(',').toLowerCase(),\n // `left,top,right,bottom`\n viewbox: o.bbox && [o.bbox[0], o.bbox[3], o.bbox[2], o.bbox[1]].join(','),\n bounded: o.bbox ? 1 : undefined,\n },\n o,\n )\n return results.map(toPlace)\n },\n reverse: async (lngLat, o = {}) => {\n const [lon, lat] = toLngLat(lngLat)\n const result = await http.get<NominatimResult>(\n '/reverse',\n { lat, lon, ...common, 'accept-language': o.language },\n o,\n )\n // \"Unable to geocode\" comes with HTTP 200.\n return result.error ? [] : [toPlace(result)]\n },\n },\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,52 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meridian-ts/nominatim",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Meridian adapter for Nominatim (OpenStreetMap): forward and reverse geocoding.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"meridian",
|
|
7
|
+
"nominatim",
|
|
8
|
+
"geocoding openstreetmap",
|
|
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/nominatim"
|
|
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
|
}
|