Giter Club home page Giter Club logo

geojson-minifier's Introduction

geojson-minifier

geojson-minifier is a small utility that minifies GeoJSON files by encoding(delta and zigzag) geometries. Depending on data, you can shrink file size up to 2-4 times, sometimes even more. Use it to speed up load time of your web application.

Installation

Either fetch source code or install with npm:

npm install -g geojson-minifier

This will give you geojson-minifier command.

CLI

Use geojson-minifier from command line passing -o, -f and -p parameters(operation, input file, decimal precision). When dealing with coordinate systems where decimal precision is important, like WGS84, use parameter -p to specify number of decimal places that utility should retain. The default is 0.

geojson-minifier -o pack -f <filename> -p 6

This will create minified version <filename>.packed in the same folder as input file. To unpack use following:

geojson-minifier -o unpack -f <filename>.packed -p 6

API

If you want to integrate geojson-minifier into existing application you can use 2 methods that API exposes - pack and unpack:

var GeojsonMinifier = require('geojson-minifier');
var minifier = new GeojsonMinifier({ precision: 6 });

var packed = minifier.pack(<geojson-object>);
var unpacked = minifier.unpack(<geojson-object>);

geojson-minifier's People

Contributors

igorti avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.