Turfjs / turf-isobands

Takes a FeatureCollection of points with z values and an array of value breaks and generates filled contour isobands.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DEPRECATED - replaced with @turf/isobands

turf-isobands

build status

turf isobands module

turf.isobands(points, z, breaks)

Takes a pointGrid FeatureCollection of points with z values and an array of value breaks and generates filled contour isobands. These are commonly used to create elevation maps, but can be used for general data interpolation as well.

Parameters

parameter type description
points FeatureCollection - grid of points
z string - a property name from which z values will be pulled
breaks Array. - where to draw contours

Example

// create a grid of points with random z-values in their properties
var bbox = [-70.823, -33.553, -69.823, -32.553];
var cellWidth = 5;
var pointGrid = turf.pointGrid(bbox, cellWidth);
for (var i = 0; i < pointGrid.features.length; i++) {
    pointGrid.features[i].properties.elevation = Math.random() * 10;
}
var breaks = [0, 2.8, 5, 8.5];
var isolined = turf.isobands(pointGrid, 'z', breaks);
//=isolined

Returns FeatureCollection, isolines (MultiPolygons)

Installation

Requires nodejs.

$ npm install turf-isobands

Tests

$ npm test

About

Takes a FeatureCollection of points with z values and an array of value breaks and generates filled contour isobands.

License:MIT License


Languages

Language:JavaScript 100.0%