npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@quantavoxel/nominatim-client

v1.1.5

Published

A JavaScript/TypeScript client for the Nominatim API (OpenStreetMap geocoding service)

Readme

@quantavoxel/nominatim-client

npm version license

A type-safe, high-performance JavaScript/TypeScript client for the Nominatim API (OpenStreetMap geocoding service).

🚀 Features

  • Type-Safe: Fully typed request and response models for all Nominatim endpoints.
  • Modern: Built for Node.js 18+ using native fetch.
  • Comprehensive: Supports search, reverse, lookup, details, and status.
  • Format Flexibility: Handles JSON, JSONv2, GeoJSON, and GeocodeJSON with automatic type switching.
  • Smart Parameters: Automatically transforms boolean flags to API-compliant numerical values (1/0).
  • Improved JSONP: Seamless support for json_callback using either strings or direct function references with automatic unwrapping.
  • Policy Compliant: Ensures mandatory User-Agent identification as per Nominatim's usage policy.

📦 Installation

npm install @quantavoxel/nominatim-client

🛠 Quick Start

import { NominatimClient } from '@quantavoxel/nominatim-client';

const client = new NominatimClient({
  userAgent: 'MyAwesomeApp/1.0 ([email protected])'
});

// Search for a location
const results = await client.search({
  q: 'Berlin',
  limit: 1
});

console.log(results[0].display_name); // "Berlin, Deutschland"

📖 API Documentation

For a complete list of parameters and detailed field descriptions, please refer to the official Nominatim API Overview.

Search

Geocoding by address or query string.

const results = await client.search({
  q: '1600 Amphitheatre Parkway, Mountain View, CA',
  format: 'geojson',
  addressdetails: true
});

Reverse

Find an address from coordinates.

const result = await client.reverse({
  lat: 52.5200,
  lon: 13.4050,
  zoom: 18
});

Lookup

Retrieve details for multiple OpenStreetMap objects.

const results = await client.lookup({
  osm_ids: 'R146656,W50637691,N240109189'
});

Details

Get technical details for a single place.

const details = await client.details({
  place_id: 12345678,
  addressdetails: true
});

Status

Check the health and synchronization status of the Nominatim server.

const status = await client.status();
console.log(status.message); // "OK"

🏠 Custom Base URL (Local Nominatim)

If you are running your own local Nominatim instance, you can point the client to your custom server by providing the baseUrl option.

const client = new NominatimClient({
  userAgent: 'MyLocalApp/1.0',
  baseUrl: 'https://my-local-nominatim.example.com'
});

This is ideal for high-volume geocoding where you want to bypass the usage limits of the public OSM instance.

⚡️ Advanced Usage

Automatic JSONP Unwrapping

The client includes advanced handling for json_callback. If you provide a function, the client will automatically unwrap the response and execute your function while still returning the parsed data.

const data = await client.search({
  q: 'Makassar',
  json_callback: (data) => console.log('Callback executed!', data)
});

Even with string-based callbacks, the client automatically strips the wrapper so you get a clean object back:

const data = await client.search({
  q: 'Jakarta',
  json_callback: 'myGlobalCallback'
});
// 'data' is already a parsed JSON object, not a string!

⚖️ Policy Compliance

Nominatim requires all clients to provide a descriptive User-Agent. The NominatimClient will throw an error if initialized without one.

// ✅ Good
const client = new NominatimClient({ userAgent: 'MyGeocoderApp/1.1' });

// ❌ Bad
const client = new NominatimClient({ userAgent: '' }); // Throws Error

🧪 Testing

The project uses Vitest for unit testing.

npm test
npm run test:coverage

📄 License

MIT © Quantavoxel