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 🙏

© 2025 – Pkg Stats / Ryan Hefner

osm2geojson-ultra

v4.0.1

Published

a faster & more complete OSM & Overpass (either in xml or in json formats) to geojson convertor - 4x faster than xmldom + osmtogeojson in most situations - implemented in TypeScript with txml for XML parsing

Readme

osm2geojson-ultra

NPM Version

A faster & more complete convertor for OSM & Overpass data in XML or JSON formats to GeoJSON - much faster (the more complex the data source is, the more performance advantages it posesses) than osmtogeojson in most situations and faster than osm2geojson-lite - implemented in TypeScript using txml to parse XML.

History

This project was forked from osm2geojson-lite to add support for more overpass geometry output types and to use a different XML parser.

Differences with osm2geojson-lite

  • Uses txml to parse XML
  • Support geometry outputs from Overpass commands such as local convert, and make
  • Support for Overpass out center; output
  • Properties have a different structure (id, type, and other non-tag properties are prefixed with @)
  • Only distributed as an ES Module
  • All options replaced by an elementId option
  • Improved polygon detection for closed ways
  • Revamped relation processing
  • Detection and reporting of tainted objects (eg: missing way nodes or relation members)

Usage

As a Node.JS Library

Installation:

$ npm install osm2geojson-ultra

Usage:

import osm2geojson from 'osm2geojson-ultra';
let geojson = osm2geojson(osm, opts);

In the Browser

<script type="module">
    import osm2geojson from 'https://esm.sh/osm2geojson-ultra';
    let geojson = osm2geojson(osm, opts);
</script>

API

osm2geojson(osm, opts)

Converts OSM data (XML/JSON) to GeoJSON.

  • osm: the OSM XML data in String, or OSM/Overpass JSON as object or in String
  • opts?: optional, the options object, right now supports below properties/fields:
    • elementId: the default value is undefined. When undefined, all tagged elements are returned. When it is set to an OSM element ID in the form of type/id, eg: "way/123" then a only that feature is returned.

Performance

  1. Workloads include the boundary XML and JSON of 4 administrive areas (zhucheng, hebei, tokyodo, usa)
  2. Call each conversion for 100 rounds to mitigate the impacts of GC and other factors
  3. For each script, run as many as times seperately and then calculate the average cost time (ACT for short)
  4. The # listed in the table below are coarse lowest values of dividing the ACT of osmtogeojson by the one of this library
$ cd test
$ npm run bench

osm2geojson-ultra

==========xml processing performance results==========
---processing zhucheng.osm---
-> 41ms was taken for 100 rounds
---processing hebei.osm---
-> 372ms was taken for 100 rounds
---processing tokyodo.osm---
-> 882ms was taken for 100 rounds
---processing usa.osm---
-> 10778ms was taken for 100 rounds
==========json processing performance results==========
---processing zhucheng.json---
-> 8ms was taken for 100 rounds
---processing hebei.json---
-> 105ms was taken for 100 rounds
---processing tokyodo.json---
-> 322ms was taken for 100 rounds
---processing usa.json---
-> 5464ms was taken for 100 rounds

osm2geojson-lite

==========xml processing performance results==========
---processing zhucheng.osm---
-> 55ms was taken for 100 rounds
---processing hebei.osm---
-> 554ms was taken for 100 rounds
---processing tokyodo.osm---
-> 1188ms was taken for 100 rounds
---processing usa.osm---
-> 12770ms was taken for 100 rounds
==========json processing performance results==========
---processing zhucheng.json---
-> 7ms was taken for 100 rounds
---processing hebei.json---
-> 104ms was taken for 100 rounds
---processing tokyodo.json---
-> 320ms was taken for 100 rounds
---processing usa.json---
-> 5554ms was taken for 100 rounds

overpasstogeojson

==========xml processing performance results==========
---processing zhucheng.osm---
-> 179ms was taken for 100 rounds
---processing hebei.osm---
-> 3488ms was taken for 100 rounds
---processing tokyodo.osm---
-> 4255ms was taken for 100 rounds
---processing usa.osm---
-> 39755ms was taken for 100 rounds
==========json processing performance results==========
---processing zhucheng.json---
-> 34ms was taken for 100 rounds
---processing hebei.json---
-> 2086ms was taken for 100 rounds
---processing tokyodo.json---
-> 1040ms was taken for 100 rounds
---processing usa.json---
-> 11273ms was taken for 100 rounds

Correctness

You can copy the converted results to geojsonlint for the correctness validation. Up until now, osm2geojson-lite behaves pretty well with all the samples (also quite representative) in the data subfolers under test and bench directories, which also outperforms osmtogeojson.

The client side example shipped along with this package, index.html - due to CORS limitation, the direct post to geojsonlint is blocked, so there's a "copy to clipboard" button for you to ease the validation.

JS version

ES 2019

Dependencies

License

MIT

Collaborators

osm2geojson-lite maintainers