0.7.2 • Published 5 years ago

xml2geojson-lite v0.7.2

Weekly downloads
2
License
ISC
Repository
github
Last release
5 years ago

xml2geojson-lite

A lightweight yet faster convertor for OSM data to GeoJSON - much faster than xmldom + osmtogeojson in most situations - implemented in pure JavaScript without any 3rd party dependency

Notice

After rounds of refactoring and feature enhancement, this package has been upgraded to osm2geojson-lite. Important changes include: 1) support the conversion from OSM/Overpass JSON; 2) support the exportation of any unreferenced geographic elements. From now on, the author's maintenance efforts will be shifted to this new package with richer features, so if applicable please stay with me by migrating your projects to osm2geojson-lite. Thanks!

Usage

nodejs library

Installation:

$ npm install xml2geojson-lite

Usage:

    const xml2geojson = require('xml2geojson-lite');
    let geojson = xml2geojson(osm_xml);

browser library

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

API

osm2geojson(osm_xml, opts)

Converts OSM XML data to GeoJSON.

  • osm_xml: the OSM XML data, in String.
  • opts?: optional - the options object, right now only supports allFeatures option, when it is set to true, it will return a comprehensive GeoJSON object as FeatureCollection rather than a bare Polygon/MultiPolygon.

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

0.7.2

5 years ago

0.7.1

5 years ago

0.7.0

5 years ago

0.6.12

5 years ago

0.6.11

5 years ago

0.6.10

5 years ago

0.6.9

5 years ago

0.6.8

5 years ago

0.6.7

5 years ago

0.6.6

5 years ago

0.6.5

5 years ago

0.6.4

5 years ago

0.6.3

5 years ago

0.6.2

5 years ago

0.6.1

5 years ago

0.6.0

5 years ago

0.5.1

5 years ago

0.5.0

5 years ago