{"name":"grid-to-matrix","version":"1.4.0","description":"Takes a GeoJSON pointGrid and returns a correspondent matrix array of 'property' values of the points","main":"grid-to-matrix.js","module":"index","jsnext:main":"index","types":"index.d.ts","files":["index.js","index.d.ts","grid-to-matrix.js","grid-to-matrix.min.js"],"scripts":{"pretest":"rollup -c rollup.config.js","test":"node test.js","bench":"node bench.js","lint":"eslint index.js"},"repository":{"type":"git","url":"git+https://github.com/stebogit/grid-to-matrix.git"},"keywords":["geojson","grid","points","array","matrix"],"author":{"name":"Stefano Borghi","email":"stefano.borghi@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/stebogit/grid-to-matrix/issues"},"devDependencies":{"@turf/point-grid":"*","@types/geojson":"*","benchmark":"*","eslint":"*","eslint-config-mourner":"*","load-json-file":"*","rollup":"*","rollup-plugin-node-resolve":"*","rollup-plugin-uglify":"*","tape":"*","typescript":"*","write-json-file":"*"},"dependencies":{"@turf/helpers":"5.x","@turf/invariant":"5.x","@turf/meta":"5.x"},"gitHead":"9174398cd7c239a72d7e716a0c0977fc3ce1f449","homepage":"https://github.com/stebogit/grid-to-matrix#readme","_id":"grid-to-matrix@1.4.0","_npmVersion":"5.4.2","_nodeVersion":"7.8.0","_npmUser":{"name":"stebogit","email":"stefano.borghi@gmail.com"},"dist":{"integrity":"sha512-EJwb1ZM7Sgt1II/C1pP4PSVyhCs2zsSNNlvJ5Dadc9n8zMBb/OmQY68zNIByWhGe97dE5/CL3/hKLrgj/lYIiA==","shasum":"0315867cf830dcf1bb875fab0710bab228141c78","tarball":"http://registry-npm.ywwl.com/grid-to-matrix/download/grid-to-matrix-1.4.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHfsWI8Hp6zhBD21Wo/BYaJ97HCZnLrjG1Aw9Re+Iu0mAiEA0MPBC/aEPe/l8Nud/0d92lESzcU5PXcx7Ngx8SHFSPM="}],"size":9855,"noattachment":false,"key":"/grid-to-matrix/-/grid-to-matrix-1.4.0.tgz"},"maintainers":[{"name":"stebogit","email":"stefano.borghi@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/grid-to-matrix-1.4.0.tgz_1507357837517_0.8599514451343566"},"directories":{},"readme":"# grid-to-matrix\n\n[![Build Status](https://travis-ci.org/stebogit/grid-to-matrix.svg?branch=master)](https://travis-ci.org/stebogit/grid-to-matrix)\n[![npm version](https://badge.fury.io/js/grid-to-matrix.svg)](https://badge.fury.io/js/grid-to-matrix)\n[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/stebogit/grid-to-matrix/blob/master/LICENSE)\n\nTakes a [Point](http://geojson.org/geojson-spec.html#point) grid and returns a correspondent matrix of the `property` values\n\n**Parameters**\n\n- `grid` \\[**[FeatureCollection](http://geojson.org/geojson-spec.html#feature-collection-objects)&lt;[Point](http://geojson.org/geojson-spec.html#point)>**] grid of points\n- `options.zProperty` \\[**[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**] the property name in `grid` from which the matrix values will be pulled (optional, default `elevation`)\n- `options.flip` \\[**[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**] returns the matrix upside-down (optional, default `false`)\n- `options.flags` \\[**[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**] , adding a `matrixPosition` array field ([`row`, `column`]) to its properties, the grid points with coordinates on the matrix (optional, default `false`)\n\n**Returns**\n\nMatrix \\[**[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 the `grid` points `property` values\n\n### Installation\n\n**npm**\n\n```sh\n$ npm install grid-to-matrix\n```\n\n**browser (ES5)**\n\n```html\n<script src=\"https://unpkg.com/grid-to-matrix/grid-to-matrix.min.js\"></script>\n```\n\n### Quickstart\n\n```javascript\n  var pointGrid = require('@turf/point-grid');\n  var gridToMatrix = require('grid-to-matrix');\n\n  var extent = [-70.823364, -33.553984, -70.473175, -33.302986];\n  var cellSize = 3;\n  var grid = pointGrid(extent, cellSize);\n  // add a random elevation property to each point between 0 and 60\n  for (var i = 0; i < grid.features.length; i++) {\n    grid.features[i].properties.elevation = (Math.random() * 60);\n  }\n\n  gridToMatrix(grid);\n  // =[\n  //    [ 1, 13, 20,  9, 10, 13, 18],\n  //    [34,  8,  0,  4,  5,  8, 13],\n  //    [10,  5,  2,  1,  2,  5, 24],\n  //    [ 0,  4, 56, 19,  0,  4,  9],\n  //    [10,  5,  2, 12,  2,  5, 10],\n  //    [57,  8,  5,  4,  5,  0, 57],\n  //    [ 3, 13,  0,  9,  5, 13, 35],\n  //    [18, 13, 10,  9, 78, 13, 18]\n  //  ]\n```\n","publish_time":1507357837587,"_cnpm_publish_time":1507357837587,"dist-tags":{"latest":"1.4.0"}}