Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@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.
pointGrid
FeatureCollection<Point> input points
breaks
Array<number> values of zProperty
where to draw isolines
options
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 []
)// 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 single module individually:
$ npm install @turf/isolines
Or install the all-encompassing @turf/turf module that includes all modules as functions:
$ npm install @turf/turf
FAQs
turf isolines module
The npm package @turf/isolines receives a total of 785,195 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 9 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.