# turf-tin

> turf tin module

Latest version **3.0.12** (published 2016-07-05) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install turf-tin
pnpm add turf-tin
yarn add turf-tin
bun add turf-tin
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 3.0.12 |
| Published | 2016-07-05 |
| First published | 2014-05-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | morganherlocker |
| Maintainers | cspanring, cwmma, jseppi, jvrousseau, lyzidiamond, morganherlocker, mourner, tcql, tmcw |
| Keywords | turf, tin, triangulate |

## Links

- npm: https://www.npmjs.com/package/turf-tin
- Repository: https://github.com/Turfjs/turf-tin
- Issues: https://github.com/Turfjs/turf-tin/issues
- npm.io page: https://npm.io/package/turf-tin

## Dependencies (1)

- [turf-helpers](https://npm.io/package/turf-helpers.md) ^3.0.12

## Alternatives

- [express-promise-router](https://npm.io/package/express-promise-router.md) — 736.1K weekly downloads
- [next-usequerystate](https://npm.io/package/next-usequerystate.md) — 29.8K weekly downloads
- [@bitkyc08/opencodex](https://npm.io/package/@bitkyc08/opencodex.md) — 4.6K weekly downloads
- [lynkr](https://npm.io/package/lynkr.md) — 575 weekly downloads
- [baremetal.js](https://npm.io/package/baremetal.js.md) — 42 weekly downloads

## Recent versions

- 3.0.12 (latest) — 2016-07-05
- 3.0.7-canary.ae89c8b3 (canary) — 2016-06-14
- 3.0.10 — 2016-06-15
- 3.0.5 — 2016-05-17
- 3.0.1 — 2016-05-16
- 3.0.0-canary.7879bf6c — 2016-05-16
- 3.0.0-canary.2f5f7167 — 2016-05-16
- 1.0.6 — 2015-02-06
- 1.0.5 — 2015-02-04
- 1.0.4 — 2015-02-04
- 1.0.3 — 2015-02-04
- 1.0.2 — 2015-01-06
- 1.0.1 — 2014-12-16
- 1.0.0 — 2014-12-11
- 0.1.0 — 2014-07-21
- … 2 more at https://npm.io/package/turf-tin/versions

## README

# turf-tin

# tin

Takes a set of [points](Point) and the name of a z-value property and
creates a [Triangulated Irregular Network](http://en.wikipedia.org/wiki/Triangulated_irregular_network),
or a TIN for short, returned as a collection of Polygons. These are often used
for developing elevation contour maps or stepped heat visualizations.

This triangulates the points, as well as adds properties called `a`, `b`,
and `c` representing the value of the given `propertyName` at each of
the points that represent the corners of the triangle.

**Parameters**

-   `points` **FeatureCollection&lt;Point>** input points
-   `z` **\[[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]** name of the property from which to pull z values
    This is optional: if not given, then there will be no extra data added to the derived triangles.

**Examples**

```javascript
// generate some random point data
var points = turf.random('points', 30, {
  bbox: [50, 30, 70, 50]
});
//=points
// add a random property to each point between 0 and 9
for (var i = 0; i < points.features.length; i++) {
  points.features[i].properties.z = ~~(Math.random() * 9);
}
var tin = turf.tin(points, 'z')
for (var i = 0; i < tin.features.length; i++) {
  var properties  = tin.features[i].properties;
  // roughly turn the properties of each
  // triangle into a fill color
  // so we can visualize the result
  properties.fill = '#' + properties.a +
    properties.b + properties.c;
}
//=tin
```

Returns **FeatureCollection&lt;Polygon>** TIN output

---

This module is part of the [Turfjs project](http://turfjs.org/), an open source
module collection dedicated to geographic algorithms. It is maintained in the
[Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
PRs and issues.

### Installation

Install this module individually:

```sh
$ npm install turf-tin
```

Or install the Turf module that includes it as a function:

```sh
$ npm install turf
```

---
_Source: https://npm.io/package/turf-tin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
