Skip to content

Commit

Permalink
Merge pull request #8 from maxogden/fall-cleaning
Browse files Browse the repository at this point in the history
Fall cleaning
  • Loading branch information
ungoldman authored Oct 9, 2016
2 parents d48b23a + 276cfe3 commit a9495ed
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 10 deletions.
2 changes: 1 addition & 1 deletion collaborators.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
simplify-geojson is only possible due to the excellent work of the following collaborators:

<table><tbody><tr><th align="left">maxogden</th><td><a href="https://github.com/maxogden">GitHub/maxogden</a></td></tr>
<tr><th align="left">ngoldman</th><td><a href="https://github.com/ngoldman">GitHub/ngoldman</a></td></tr>
<tr><th align="left">ungoldman</th><td><a href="https://github.com/ungoldman">GitHub/ungoldman</a></td></tr>
</tbody></table>
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"simplify-geometry": "0.0.2"
},
"devDependencies": {
"standard": "^6.0.4",
"standard": "^8.3.0",
"tape": "^4.4.0"
},
"homepage": "https://github.com/maxogden/simplify-geojson",
Expand Down
21 changes: 17 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
# simplify-geojson

Apply [Ramer–Douglas–Peucker](https://en.wikipedia.org/wiki/Ramer%E2%80%93Douglas%E2%80%93Peucker_algorithm) line simplification to [GeoJSON](http://www.geojson.org/) features or feature collections in JS or on the CLI. This module uses https://github.com/seabre/simplify-geometry for the simplification and wraps it in a interface for easily simplifying GeoJSON.
Apply [Ramer–Douglas–Peucker](https://en.wikipedia.org/wiki/Ramer%E2%80%93Douglas%E2%80%93Peucker_algorithm) line simplification to [GeoJSON](http://www.geojson.org/) features or feature collections in JS or on the CLI.

[![NPM](https://nodei.co/npm/simplify-geojson.png)](https://nodei.co/npm/simplify-geojson/)

This module uses https://github.com/seabre/simplify-geometry for the simplification and wraps it in a interface for easily simplifying GeoJSON.

## Install

```
npm install simplify-geojson
```

## Usage

### CLI

```sh
npm install simplify-geojson -g
cat data.geojson | simplify-geojson -t 0.01
```

Expand All @@ -30,7 +39,7 @@ var simplified = simplify(geojson, tolerance)

All segments in any of the supported types will be simplified (including holes in polygons, for instance).

## examples
## Examples

Convert a CSV with lat/lon columns into geojson, then simplify that geojson, then open it in [geojson.io](http://geojson.io/) (CSV is from my GPS logger and was my bike commute this morning):

Expand All @@ -50,6 +59,10 @@ curl https://rawgit.com/johan/world.geo.json/master/countries/USA/AK.geo.json |
wc -l
```

## Contributing

Contributors welcome! Please read the [contributing guidelines](contributing.md) before getting started.

## License

BSD
[BSD-2-Clause](https://spdx.org/licenses/BSD-2-Clause.html)
8 changes: 4 additions & 4 deletions test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
var test = require('tape')
var fs = require('fs')
var concat = require('concat-stream')
var child_process = require('child_process')
var spawn = child_process.spawn
var exec = child_process.exec
var proc = require('child_process')
var spawn = proc.spawn
var exec = proc.exec
var simplify = require('./')

test('FeatureCollection w/ a LineString in it', function (t) {
Expand Down Expand Up @@ -84,7 +84,7 @@ test('curl from alaska example test', function (t) {
t.plan(1)

var cmd = 'curl -s https://rawgit.com/johan/world.geo.json/master/countries/USA/AK.geo.json | '
cmd += 'simplify-geojson -t 0.01 | '
cmd += './cli.js -t 0.01 | '
cmd += 'wc -l'

var proc = exec(cmd)
Expand Down

0 comments on commit a9495ed

Please sign in to comment.