A simple wrapper around OpenStreetMap's Nominatim API. Fully typed.
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.
This library runs on Node.js and is available as a NPM package.
npm install nominatim-tsImport the package to get started.
import * as Nominatim from "nominatim-ts"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);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);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);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.