nominatim-ts
v0.1.4
Published
A simple wrapper around OpenStreetMap's Nominatim API. Fully typed.
Readme
Nominatim-TS
A simple wrapper around OpenStreetMap's Nominatim API. Fully typed.
Documentation
Nominatim-TS aims to replicate OpenStreetMap's Nominatim API as closely as possible, while making its complex data model and various response formats play nice with any typescript project.
Full documentation and typings are available here.
Installation
This library runs on Node.js and is available as a NPM package.
npm install nominatim-tsUsage
Import the package to get started.
import * as Nominatim from "nominatim-ts"Search
The search function allows you to search for places by name or address.
const searchResults = await Nominatim.search({
q: "Eiffel Tower",
format: "json",
limit: 1,
});
console.log(searchResults);It maps one-to-one with nominatim's Search API endpoint. As such, it supports all the parameters that the Search API does.
const searchResults = await Nominatim.search({
q: "Eiffel Tower",
format: "json",
limit: 1,
});
console.log(searchResults);Lookup
The lookup function retrieves details about specific OSM objects using their OSM IDs.
const result = await Nominatim.lookup({
osm_ids: ["R146656", "W104393803", "N240109189"],
format: "json",
});
console.log(result);Reverse Geocoding
The reverse function converts geographic coordinates to a human-readable address.
const address = await Nominatim.reverse({
lat: 51.5074,
lon: -0.1278,
format: "json",
});
console.log(address);Status
The status function provides information about the Nominatim service status.
const status = await Nominatim.status();
console.log(status);For more detailed information on each function and its parameters, please refer to the full documentation.
