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

@osm-traffic-signs/converter

v0.8.0

Published

Convert traffic sign IDs to OSM tags; suggest a traffic_sign-tag based on OSM tags.

Readme

OpenStreetMap Traffic Sign Converter

Convert traffic sign IDs to OSM tags Suggest a traffic_sign-tag based on OSM tags.

Installation

npm install @osm-traffic-signs/converter

Main methods

| Function | Input | Output | | ---------------------------- | -------------------------------------------- | ------------------------------------ | | trafficSignTagToSigns | 'DE:250,1022-10', country | [{ /* Sign Object */ }] | | tagsToSigns | country, ['vehicle=no', 'bicycle=yes'] | [{ /* Sign Object */ }] | | signsToTrafficSignTagValue | [{ /* Sign Object */ }], country | 'DE:250,1022-10' | | signsToTags | [{ /* Sign Object */ }], country, geometry | Map of recommended OSM tags | | signsToComments | [{ /* Sign Object */ }], geometry | Map of comments per tag | | getSignRelation | country, '274.1' or a sign object | { kind, topic, role, counterpart } |

Geometry is one of GEOMETRY_TYPES ('node', 'way', 'way_centerline', 'area', 'relation'): a sign can recommend different tags depending on the object it is mapped on.

Main data

Use countryDefinitions to access the traffic sign objects per country and countries for the list of country prefixes. DE is the main catalogue; AT, AU, BE, BR, CA, FR, IT and PL are beta catalogues imported from the OSM Wiki (see getCountryCatalogueMeta()).

Related signs

getSignRelation() returns the sign that belongs to another one: the end of a zone (274.1 → 274.2) or of a rule along the road (274-50 → 278-50), the other side of a place sign (310 → 311), or the opposite direction of a slope (108[12] → 110[12]). kind is zone, section, place or incline, role is start, end, downhill or uphill. The pairs per country are in signRelations.

Example usage

import {
  signsToTags,
  signsToTrafficSignTagValue,
  trafficSignTagToSigns,
} from '@osm-traffic-signs/converter'

const signs = trafficSignTagToSigns('DE:240', 'DE')

signsToTrafficSignTagValue(signs, 'DE')
// 'DE:240'

Object.fromEntries(signsToTags(signs, 'DE', 'way'))
// {
//   highway: ['path'], // allowed values
//   foot: 'designated',
//   bicycle: 'designated',
//   segregated: 'no',
//   traffic_sign: 'DE:240',
// }

Browser build (iD traffic sign field)

For editors that load the converter at runtime without a bundler, the package ships a self-contained, minified ESM build. It has no bare imports (opening_hours is bundled).

| Import | File | Content | | ----------------------------------------------- | -------------------------- | --------------------------------------------------------------------------------------------------- | | @osm-traffic-signs/converter/id-field-browser | dist/id-field-browser.js | trafficSignTagToSigns, signsToTags, signsToTrafficSignTagValue, countries and a few helpers | | @osm-traffic-signs/converter/data/DE | dist/data/<COUNTRY>.js | trafficSignData: the sign catalogue of one country, to load only the countries you need |

The files share chunks in dist/, so copy or serve the whole set (id-field-browser.js, data/ and the chunk files next to them) rather than single files. They are used by @osm-traffic-signs/id-field.

JSON catalogues

For tools without JavaScript (Python, QGIS, wiki scripts) each country's catalogue is also available as JSON: dist/data/<COUNTRY>.json, importable as @osm-traffic-signs/converter/data/DE.json. It holds country, the package version, the sign configs in signs (the same objects as countryDefinitions) and the sign pairs in relations (see getSignRelation()).

SVG assets / Vite lazy loading

Bundled traffic-sign SVGs ship as separate subpath exports. For runtime loading in Vite (or similar bundlers), prefer lazy APIs so only the SVGs you actually render are fetched.

| Use case | Import | | ------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------- | | Recommended — load one sign at runtime | loadTrafficSignSvg('DE', sign) from the main entry, or import { SvgLoadersDE } from '@osm-traffic-signs/converter/data-svgs/DE/loaders' | | Check whether a bundled SVG exists | hasBundledSvg from the main entry | | Eager namespace (legacy) | import { SvgsDE } from '@osm-traffic-signs/converter/data-svgs/eager' | | Single static SVG | import x from '@osm-traffic-signs/converter/data-svgs/DE/svgs/DE_274_30.svg' or import { DE_274_30 } from '@osm-traffic-signs/converter/data-svgs/DE' |

import { hasBundledSvg, loadTrafficSignSvg } from '@osm-traffic-signs/converter'

if (hasBundledSvg('DE', sign)) {
  const svgUrl = await loadTrafficSignSvg('DE', sign)
}

Vite pitfall: Do not import eager SVG namespaces from @osm-traffic-signs/converter/data-svgs/eager (or the old combined root barrel) unless you intend to bundle every SVG for that country. The root @osm-traffic-signs/converter/data-svgs entry exports loader maps only.

Per-country loaders are the documented default for direct map access:

import { SvgLoadersDE } from '@osm-traffic-signs/converter/data-svgs/DE/loaders'

const loader = SvgLoadersDE['DE_274__30__']
const { default: svgUrl } = loader ? await loader() : { default: undefined }

Licence: GNU AGPLv3

LICENCE