Security News
cURL Project and Go Security Teams Reject CVSS as Broken
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
@turf/isolines
Advanced tools
@turf/isolines is a module within the Turf.js library that allows you to generate isolines (contour lines) from a grid of points with z-values. This is useful for visualizing elevation, temperature, or other continuous data over a geographic area.
Generate Isolines
This feature allows you to generate isolines from a grid of points with z-values. The code sample demonstrates creating a grid of points, assigning random z-values, and generating isolines based on specified breaks.
const turf = require('@turf/turf');
// Create a grid of points with z-values
const points = turf.pointGrid([-95, 30, -85, 40], 100, { units: 'miles' });
points.features.forEach((point, i) => {
point.properties.z = Math.random() * 10;
});
// Generate isolines
const breaks = [0, 2, 4, 6, 8, 10];
const isolines = turf.isolines(points, breaks, { zProperty: 'z' });
console.log(JSON.stringify(isolines));
d3-contour is a module in the D3.js library that provides tools for generating contour plots. It is similar to @turf/isolines in that it can generate contour lines from a set of data points. However, d3-contour is more focused on data visualization and is part of the broader D3.js ecosystem, which is widely used for creating complex and interactive visualizations.
marching-squares is a JavaScript library for generating contour lines using the Marching Squares algorithm. It is similar to @turf/isolines in that it can generate contour lines from a grid of data points. However, marching-squares is a more specialized library focused solely on the contour generation algorithm, whereas @turf/isolines is part of the larger Turf.js library for geospatial analysis.
Takes a grid FeatureCollection of Point features with z-values and an array of value breaks and generates isolines.
Parameters
pointGrid
FeatureCollection<Point> input pointsbreaks
Array<number> values of zProperty
where to draw isolinesoptions
Object Optional parameters (optional, default {}
)
options.zProperty
string the property name in points
from which z-values will be pulled (optional, default 'elevation'
)options.commonProperties
Object GeoJSON properties passed to ALL isolines (optional, default {}
)options.breaksProperties
Array<Object> GeoJSON properties passed, in order, to the correspondent isoline;
the breaks array will define the order in which the isolines are created (optional, default []
)Examples
// create a grid of points with random z-values in their properties
var extent = [0, 30, 20, 50];
var cellWidth = 100;
var pointGrid = turf.pointGrid(extent, cellWidth, {units: 'miles'});
for (var i = 0; i < pointGrid.features.length; i++) {
pointGrid.features[i].properties.temperature = Math.random() * 10;
}
var breaks = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
var lines = turf.isolines(pointGrid, breaks, {zProperty: 'temperature'});
//addToMap
var addToMap = [lines];
Returns FeatureCollection<MultiLineString> a FeatureCollection of MultiLineString features representing isolines
This module is part of the Turfjs project, an open source module collection dedicated to geographic algorithms. It is maintained in the Turfjs/turf repository, where you can create PRs and issues.
Install this module individually:
$ npm install @turf/isolines
Or install the Turf module that includes it as a function:
$ npm install @turf/turf
6.4.0
@turf/boolean-point-on-line
Added an epislon
option to help in floating point comparison.
(PR https://github.com/Turfjs/turf/pull/2051 - Author @okcoker)@turf/line-slice-along
Fixed a bug where the offset distance equal to the length of the line
(PR https://github.com/Turfjs/turf/pull/2030 - Author @EricPKerr)
@turf/helpers
Fixed the conversion ratio for converting meters to yards and vice-versa
(PR https://github.com/Turfjs/turf/pull/2046 - Author @anotherhale)
@turf/center-median
Fixed a missing TS type import
(PR https://github.com/Turfjs/turf/pull/2044 - Author @Seairth)
`@turf/bezier-spline Fix a bug ensuring the spline result reaches the end of the input (PR https://github.com/Turfjs/turf/pull/2090 - Author @the-nemz)
@turf/transform-rotate
and @turf/ellipse
) Improve documentation for angle parameter
(PR https://github.com/Turfjs/turf/pull/2016 - Author @pasieronen)
@turf/line-chunk
Fix an invalid anchor
(PR https://github.com/Turfjs/turf/pull/2071 - Author @GraxMonzo)
@turf/distance
Enhance distance doco so supported inputs are clearer
(PR https://github.com/Turfjs/turf/pull/2032 - Author @rowanwins)
@turf/concave
Replace deprecated topojson dependency
(PR https://github.com/Turfjs/turf/pull/2037 - Author @elliots)
Work towards enabling TS Strict Mode (PR https://github.com/Turfjs/turf/pull/2053 - Author @mfedderly)
FAQs
turf isolines module
The npm package @turf/isolines receives a total of 427,987 weekly downloads. As such, @turf/isolines popularity was classified as popular.
We found that @turf/isolines demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.