# matrix-to-grid

> Takes a matrix array of numbers and returns a grid of GeoJSON points with correspondent property value

Latest version **4.0.0** (published 2017-10-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install matrix-to-grid
pnpm add matrix-to-grid
yarn add matrix-to-grid
bun add matrix-to-grid
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.0 |
| Published | 2017-10-07 |
| First published | 2017-04-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Stefano Borghi |
| Maintainers | stebogit |
| Keywords | geojson, grid, points, array, matrix |

## Links

- npm: https://www.npmjs.com/package/matrix-to-grid
- Repository: https://github.com/stebogit/matrix-to-grid
- Homepage: https://github.com/stebogit/matrix-to-grid#readme
- Issues: https://github.com/stebogit/matrix-to-grid/issues
- npm.io page: https://npm.io/package/matrix-to-grid

## Dependencies (2)

- [@turf/helpers](https://npm.io/package/@turf/helpers.md) 5.x
- [@turf/rhumb-destination](https://npm.io/package/@turf/rhumb-destination.md) 5.x

## Alternatives

- [@lexical/table](https://npm.io/package/@lexical/table.md) — 3.0M weekly downloads
- [mantine-datatable](https://npm.io/package/mantine-datatable.md) — 98.2K weekly downloads
- [react-native-collapsible-tab-view](https://npm.io/package/react-native-collapsible-tab-view.md) — 70.6K weekly downloads
- [@handsontable/vue3](https://npm.io/package/@handsontable/vue3.md) — 16.1K weekly downloads
- [vuewordcloud](https://npm.io/package/vuewordcloud.md) — 7.2K weekly downloads

## Recent versions

- 4.0.0 (latest) — 2017-10-07
- 3.0.1 — 2017-05-06
- 3.0.0 — 2017-05-01
- 2.0.0 — 2017-04-17
- 1.0.0 — 2017-04-16

## README

# matrix-to-grid
<!-- [![Build Status](https://travis-ci.org/stebogit/matrix-to-grid.svg?branch=master)](https://travis-ci.org/stebogit/matrix-to-grid) -->
[![Build Status](https://travis-ci.org/stebogit/matrix-to-grid.svg?branch=master)](https://travis-ci.org/stebogit/matrix-to-grid)
[![npm version](https://badge.fury.io/js/matrix-to-grid.svg)](https://badge.fury.io/js/matrix-to-grid)
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/stebogit/matrix-to-grid/blob/master/LICENSE)

Takes a matrix of the values and returns a [Point](http://geojson.org/geojson-spec.html#point) grid mapping the values of the matrix as `property`

**Parameters**

- `matrix` \[**[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<Array<<[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>>**] of numbers

- `origin` \[**[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)> | [Feature](http://geojson.org/geojson-spec.html#feature-objects)&lt;[Point](http://geojson.org/geojson-spec.html#point)>**] position of the first bottom-left (South-West) point of the grid

-   `cellSize` \[**[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)**] the distance across each cell

- `options` \[**[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**] optional parameters:

    - `zProperty` \[**[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**] the name of the property of the points which will represent the correspondent matrix value (optional, default `elevation`)
    
    - `properties` \[**[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**] GeoJSON properties passed to all the points (optional, default `{}`)
    
    - `units` \[**[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**] miles or kilometers (optional, default `kilometers`)

**Returns**

Returns a \[**[FeatureCollection](http://geojson.org/geojson-spec.html#feature-collection-objects)&lt;[Point](http://geojson.org/geojson-spec.html#point)>**] grid of points having each the correspondend p`property` value of the matrix


### Installation

**npm**

```sh
$ npm install matrix-to-grid
```

**browser (ES5)**

```html
<script src="https://unpkg.com/matrix-to-grid/matrix-to-grid.min.js"></script>
```

### Quickstart

```javascript
  var matrixToGrid = require('matrix-to-grid');
  var matrix = [
    [ 1, 13, 20,  9, 10, 13, 18],
    [34,  8,  0,  4,  5,  8, 13],
    [10,  5,  2,  1,  2,  5, 24],
    [ 0,  4, 56, 19,  0,  4,  9],
    [10,  5,  2, 12,  2,  5, 10],
    [57,  8,  5,  4,  5,  0, 57],
    [ 3, 13,  0,  9,  5, 13, 35],
    [18, 13, 10,  9, 78, 13, 18]
  ];
  var origin = [-70.823364, -33.553984];
  matrixToGrid(matrix, origin, 10);
  // = pointGrid
```

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