src/lib/toCanvasXY.js
function trimCanvasXY(xy) {
    if( xy.length === 0 ) return;
    var last = xy[xy.length-1], i, point;

    var c = 0;
    for( i = xy.length-2; i >= 0; i-- ) {
        point = xy[i];
        if( Math.abs(last.x - point.x) === 0 && Math.abs(last.y - point.y) === 0 ) {
            xy.splice(i, 1);
            c++;
        } else {
            last = point;
        }
    }

    if( xy.length <= 1 ) {
        xy.push(last);
        c--;
    }
}
function trimCanvasXY(xy) {
    if( xy.length === 0 ) return;
    var last = xy[xy.length-1], i, point;

    var c = 0;
    for( i = xy.length-2; i >= 0; i-- ) {
        point = xy[i];
        if( Math.abs(last.x - point.x) === 0 && Math.abs(last.y - point.y) === 0 ) {
            xy.splice(i, 1);
            c++;
        } else {
            last = point;
        }
    }

    if( xy.length <= 1 ) {
        xy.push(last);
        c--;
    }
}
function trimCanvasXY ( xy ) { if ( xy . length === 0 ) return ; var last = xy [ xy . length - 1 ] , i , point ; var c = 0 ; for ( i = xy . length - 2 ; i >= 0 ; i -- ) { point = xy [ i ] ; if ( Math . abs ( last . x - point . x ) === 0 && Math . abs ( last . y - point . y ) === 0 ) { xy . splice ( i , 1 ) ; c ++ ; } else { last = point ; } } if ( xy . length <= 1 ) { xy . push ( last ) ; c -- ; } }
given an array of geo xy coordinates, make sure each point is at least more than 1px apart
given an array of geo xy coordinates make sure each point is at least more than 1px apart