turf node example
This is an example of how to use Turf for a scripting task with node. This technique lets you process bigger amounts of data than you could in a browser, and have node read and write files.
You'll need a few skills to get started:
- A text editor for code. Good options include Atom, Sublime Text, and Brackets.
node: nodejs.org provides a free download and installer for all major platforms.
- Ability to use your terminal: here's an introduction for Mac users
If you have
node installed, you also have a command called
this is what you use to download extra software for
node. This project has
some preset requirements, which are stored in package.json,
so if you open a terminal in the same folder as this project and run the command
$ npm install
npm command with automatically find, download, and install
to this directory.
Next, you should open
index.js, either locally or
on GitHub, read through the code comments to understand what it does.
When you feel comfortable with your understanding of the process, run it:
$ node index.js
node to run the code in
index.js. That should quickly report:
$ node index.js saved output/convex_hull.geojson
And you can open the files
to see what the script did.