Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

osm2geojson-lite

Package Overview
Dependencies
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

osm2geojson-lite

a lightweight yet faster osm (either in xml or in json formats) to geojson convertor - 4x faster than xmldom + osmtogeojson in most situations - implemented in pure JavaScript without any 3rd party dependency

  • 0.5.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
456
increased by53.54%
Maintainers
1
Weekly downloads
 
Created
Source

osm2geojson-lite

A lightweight (not as lightweight as xml2geojson though) yet faster convertor for OSM data whatever 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 - implemented in pure JavaScript without any 3rd party dependency.

History

An internal function inside query-geo-boundary → stripped to handle OSM XML only xml2geojson-lite → this library that supports both OSM XML and JSON

Usage

In Node.JS

Installation:

$ npm install osm2geojson-lite

Usage:

    const osm2geojson = require('osm2geojson-lite');
    let geojson = osm2geojson(osm);

In Browser

    <script src='your/path/to/osm2geojson-lite.js'></script>
    let geojson = osm2geojson(osm);

API

osm2geojson(osm, opts)

Converts OSM data (XML/JSON) to GeoJSON.

  • osm: the OSM XML data in String, or OSM/Overpass JSON object
  • ?opts: optional, the options object, right now supports below properties/fields:
    • completeFeature/allFeatures: the default value is false. When it's set to true, the returned geojson will include all elements meets the specified conditions in FeatureCollection format; otherwise, only the bare geojson of the first relation element will be returned.
    • renderTagged: the default value is false. When it's set to true, the returned geojson will include all elements with tags (i.e., tagged) until suppressWay changes its behavior a bit; otherwise only the unreferenced ones get returned.
    • suppressWay/excludeWay: by default value os true. When it's set to true, the return value will exclude any referenced ways even though they are tagged; otherwise the features of all tagged way will be included, too.

Reminder

Please fasten your seat-belt before run the test script (node test.js)

Node.JS version

ES5/ES6 features

Dependencies

  • No 3rd party dependency

License

Written in 2018 by tibetty xihua.duan@gmail.com

Keywords

FAQs

Package last updated on 15 Jan 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc