GithubHelp home page GithubHelp logo

decimal-clipper's Introduction

GeoJSON Decimal Clipper

Strips gratuitous decimals from a GeoJSON file. But will work for any text file, really.

// original uber precise coords
[-90.3515625,53.73571574532637],[-92.13134765625,53.199451902831555]

// after running, clipped to your liking
[-90.35156,53.73571],[-92.13134,53.19945]

Careful Now

  • Will affect every decimal number in the file, not just Geometry co-ords
  • Will even update numbers encoded in strings.
  • Does not round. Just drops the offending precision.
  • Untested for anything other than UTF8 text files.

Command Line

To pull the dependencies

npm install

To givver

npm run start

App Setup

To change the number of decimal values to keep, update the value of MAX_DECIMAL in index.ts.

To change the file to process, update the parameter of the very last line of index.ts.

parser('./localFolder/myfile.json');

The processed file will be written in the same location, with filename origfilename.squash.json.

Testing

Works on my machine.

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.