GithubHelp home page GithubHelp logo

geosimplify-js's Introduction

geosimplify-js

This module simplifies sequences of [longitude,latitude] pairs using geography-aware measurement thresholds.

Based on https://github.com/mourner/simplify-js, geosimplify-js fixes the problem that the simple pythagorean measure used in simplify-js changes size if you simply give it longitude/latitude sequences to simplify.

Usage:

simplify([[lon,lat],[lon,lat],[lon,lat]], offsetThresholdInMetres, gapThresholdInMetres);

path - an array of longitude,latitude pairs

offsetThreshold - how far outside the straight line a point needs to be for it to be "kept"

gapThreshold - if removing a point would create a segment longer than this, do not remove it

Example:

var geosimplify = require('@mapbox/geosimplify-js');
var coords = [ [ 15.603332, 78.227070 ],
               [ 15.606422, 78.226824 ],
               [ 15.608782, 78.226667 ],
               [ 15.610799, 78.226535 ] ];
var result = geosimplify(coords, 5, 50);

geosimplify-js's People

Contributors

danpat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

geosimplify-js's Issues

gapTolerance does not work

It doesn't appear any value of gapTolerance changes the output of geosimplify.

The getDist function which is used to handle the gapTolerance behavior, doesn't return a value (i.e., it returns void) which probably contributes to the issue.

function getDist(p1, p2) {
getRuler(p1[1]).distance(p1, p2);
}

The following tests (and more) could be added to check the gapTolerance argument.

result = geosimplify(equator_latitude_5m_offset, 5.0, 1);
t.equal(result.length, 3, 'Removed no coordinates');

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.