{"id":16919894,"url":"https://github.com/stebogit/grid-to-matrix","last_synced_at":"2025-04-12T23:41:47.156Z","repository":{"id":57254104,"uuid":"88233539","full_name":"stebogit/grid-to-matrix","owner":"stebogit","description":"Takes a pointGrid and returns a correspondent matrix of the 'property' values","archived":false,"fork":false,"pushed_at":"2017-10-07T06:30:16.000Z","size":100,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-26T17:47:17.785Z","etag":null,"topics":["geojson","grid","matrix","points","turfjs"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stebogit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-14T04:43:12.000Z","updated_at":"2017-04-16T15:21:17.000Z","dependencies_parsed_at":"2022-08-31T08:21:35.035Z","dependency_job_id":null,"html_url":"https://github.com/stebogit/grid-to-matrix","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stebogit%2Fgrid-to-matrix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stebogit%2Fgrid-to-matrix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stebogit%2Fgrid-to-matrix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stebogit%2Fgrid-to-matrix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stebogit","download_url":"https://codeload.github.com/stebogit/grid-to-matrix/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248154989,"owners_count":21056544,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["geojson","grid","matrix","points","turfjs"],"created_at":"2024-10-13T19:46:04.732Z","updated_at":"2025-04-12T23:41:47.131Z","avatar_url":"https://github.com/stebogit.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"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)\u0026lt;[Point](http://geojson.org/geojson-spec.html#point)\u003e**] 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)\u003cArray\u003c\u003c[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)\u003e\u003e**] 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\u003cscript src=\"https://unpkg.com/grid-to-matrix/grid-to-matrix.min.js\"\u003e\u003c/script\u003e\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 \u003c 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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstebogit%2Fgrid-to-matrix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstebogit%2Fgrid-to-matrix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstebogit%2Fgrid-to-matrix/lists"}