geojson_lite

1.0.0 • Public • Published

GeoJSON Lite

Build Status

GeoJSON Lite is a small GeoJSON validator, and random GeoJSON generator. That is, it can do two things: tell if a GeoJSON object is invalid, and generate random, valid GeoJSON objects. It was created for testing, and benchmarking purposes.

The library is published under the MIT license. Feel free to use it, or adapt it. Forks, and PRs are also welcome.

API Documentation

You can reach the API Documentation here.

Compile

To compile the source code, first install the node dependencies of the package.

npm install

Next, you can compile the package with compile.js.

node compile.js

Testing

GeoJSON Lite uses Jasmine as a testing framework. To run the tests, simply start testing in Node.

npm test

NPM

The project is also available as an NPM package.

Installation

npm install geojson-lite

Usage

As this is a small project, which targets browsers, but still wants to harness the power of compiled JS, there are some naming conventions, which were necessarry for Closure Compiler to keep some of the references. One of them was:

window['gjl'] = gjl;

which isntantly throws a reference error in Node.js. To avoid this, you must do some patching around. You can either create an alias of window to GLOBAL before requiring the package.

GLOBAL.window = GLOBAL;

require(geojson_lite);

Alternatively, you can simply remove the upper mentioned mischievous line, and add the gjl namespace to the GLOBAL scope directly.

GLOBAL.gjl = {};

Credits

  • Inspiration and the idea for the main functionality taken from the Python geojson package.
  • Some of the naming conventions are taken from OpenLayers 3.
  • The namespace gjl resembles to the GeoJSON Utils for JavaScript package's gju namespace. It is not intentional, the namespace GeoJSON was simply taken. It is a great package, though.
  • For testing, the jasmine-node package is used.
  • For compiling the code, Google's Closure Compiler is used.
  • For generating the API Documentation, JSDoc 3 is used.

Package Sidebar

Install

npm i geojson_lite

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • gaborfarkas