Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

matrix-to-grid

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

matrix-to-grid

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

  • 4.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
33
decreased by-21.43%
Maintainers
1
Weekly downloads
 
Created
Source

matrix-to-grid

Build Status npm version MIT licensed

Takes a matrix of the values and returns a Point grid mapping the values of the matrix as property

Parameters

  • matrix [Array<Array<<number>>] of numbers

  • origin [Array<number> | Feature<Point>] position of the first bottom-left (South-West) point of the grid

  • cellSize [number] the distance across each cell

  • options [Object] optional parameters:

    • zProperty [string] the name of the property of the points which will represent the correspondent matrix value (optional, default elevation)

    • properties [Object] GeoJSON properties passed to all the points (optional, default {})

    • units [string] miles or kilometers (optional, default kilometers)

Returns

Returns a [FeatureCollection<Point>] grid of points having each the correspondend pproperty value of the matrix

Installation

npm

$ npm install matrix-to-grid

browser (ES5)

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

Quickstart

  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

Keywords

FAQs

Package last updated on 07 Oct 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc