New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@turf/isolines

Package Overview
Dependencies
Maintainers
4
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turf/isolines - npm Package Compare versions

Comparing version 5.0.4 to 5.0.5

main.mjs

20

index.js

@@ -53,4 +53,4 @@ import bbox from '@turf/bbox';

var matrix = gridToMatrix(pointGrid, {zProperty: zProperty, flip: true});
var isolines = createIsoLines(matrix, breaks, zProperty, commonProperties, breaksProperties);
var scaledIsolines = rescaleIsolines(isolines, matrix, pointGrid);
var createdIsoLines = createIsoLines(matrix, breaks, zProperty, commonProperties, breaksProperties);
var scaledIsolines = rescaleIsolines(createdIsoLines, matrix, pointGrid);

@@ -76,3 +76,3 @@ return featureCollection(scaledIsolines);

function createIsoLines(matrix, breaks, zProperty, commonProperties, breaksProperties) {
var isolines = [];
var results = [];
for (var i = 1; i < breaks.length; i++) {

@@ -89,5 +89,5 @@ var threshold = +breaks[i]; // make sure it's a number

isolines.push(isoline);
results.push(isoline);
}
return isolines;
return results;
}

@@ -99,3 +99,3 @@

* @private
* @param {Array<MultiLineString>} isolines to be rescaled
* @param {Array<MultiLineString>} createdIsoLines to be rescaled
* @param {Array<Array<number>>} matrix Grid Data

@@ -105,3 +105,3 @@ * @param {Object} points Points by Latitude

*/
function rescaleIsolines(isolines, matrix, points) {
function rescaleIsolines(createdIsoLines, matrix, points) {

@@ -130,9 +130,9 @@ // get dimensions (on the map) of the original grid

// resize and shift each point/line of the isolines
isolines.forEach(function (isoline) {
// resize and shift each point/line of the createdIsoLines
createdIsoLines.forEach(function (isoline) {
coordEach(isoline, resize);
});
return isolines;
return createdIsoLines;
}
export default isolines;

@@ -44,3 +44,3 @@ 'use strict';

if (settings.verbose)
console.log('MarchingSquaresJS-isoContours: computing isocontour for ' + threshold);
{ console.log('MarchingSquaresJS-isoContours: computing isocontour for ' + threshold); }

@@ -50,3 +50,3 @@ var ret = contourGrid2Paths(computeContourGrid(data, threshold));

if (typeof settings.successCallback === 'function')
settings.successCallback(ret);
{ settings.successCallback(ret); }

@@ -209,2 +209,4 @@ return ret;

var path_idx = 0;
var rows = grid.rows;
var cols = grid.cols;
var epsilon = 1e-7;

@@ -237,3 +239,3 @@

if (!merged)
paths[path_idx++] = p.path;
{ paths[path_idx++] = p.path; }
}

@@ -260,2 +262,3 @@ });

var startCell = grid[j][i];
var currentCell = grid[j][i];

@@ -379,3 +382,3 @@

options = options || {};
if (!helpers.isObject(options)) throw new Error('options is invalid');
if (!helpers.isObject(options)) { throw new Error('options is invalid'); }
var zProperty = options.zProperty || 'elevation';

@@ -399,6 +402,6 @@ var flip = options.flip;

// Check if zProperty exist
if (point.properties[zProperty]) row.push(point.properties[zProperty]);
else row.push(0);
if (point.properties[zProperty]) { row.push(point.properties[zProperty]); }
else { row.push(0); }
// add flags
if (flags === true) point.properties.matrixPosition = [r, c];
if (flags === true) { point.properties.matrixPosition = [r, c]; }
}

@@ -425,3 +428,3 @@ matrix.push(row);

var lat = invariant.getCoords(point)[1];
if (!pointsByLatitude[lat]) pointsByLatitude[lat] = [];
if (!pointsByLatitude[lat]) { pointsByLatitude[lat] = []; }
pointsByLatitude[lat].push(point);

@@ -441,4 +444,4 @@ });

var pointMatrix = orderedRowsByLatitude.sort(function (a, b) {
if (flip) return invariant.getCoords(a[0])[1] - invariant.getCoords(b[0])[1];
else return invariant.getCoords(b[0])[1] - invariant.getCoords(a[0])[1];
if (flip) { return invariant.getCoords(a[0])[1] - invariant.getCoords(b[0])[1]; }
else { return invariant.getCoords(b[0])[1] - invariant.getCoords(a[0])[1]; }
});

@@ -480,3 +483,3 @@

options = options || {};
if (!helpers.isObject(options)) throw new Error('options is invalid');
if (!helpers.isObject(options)) { throw new Error('options is invalid'); }
var zProperty = options.zProperty || 'elevation';

@@ -488,11 +491,11 @@ var commonProperties = options.commonProperties || {};

invariant.collectionOf(pointGrid, 'Point', 'Input must contain Points');
if (!breaks) throw new Error('breaks is required');
if (!Array.isArray(breaks)) throw new Error('breaks must be an Array');
if (!helpers.isObject(commonProperties)) throw new Error('commonProperties must be an Object');
if (!Array.isArray(breaksProperties)) throw new Error('breaksProperties must be an Array');
if (!breaks) { throw new Error('breaks is required'); }
if (!Array.isArray(breaks)) { throw new Error('breaks must be an Array'); }
if (!helpers.isObject(commonProperties)) { throw new Error('commonProperties must be an Object'); }
if (!Array.isArray(breaksProperties)) { throw new Error('breaksProperties must be an Array'); }
// Isoline methods
var matrix = gridToMatrix(pointGrid, {zProperty: zProperty, flip: true});
var isolines = createIsoLines(matrix, breaks, zProperty, commonProperties, breaksProperties);
var scaledIsolines = rescaleIsolines(isolines, matrix, pointGrid);
var createdIsoLines = createIsoLines(matrix, breaks, zProperty, commonProperties, breaksProperties);
var scaledIsolines = rescaleIsolines(createdIsoLines, matrix, pointGrid);

@@ -518,3 +521,3 @@ return helpers.featureCollection(scaledIsolines);

function createIsoLines(matrix, breaks, zProperty, commonProperties, breaksProperties) {
var isolines = [];
var results = [];
for (var i = 1; i < breaks.length; i++) {

@@ -531,5 +534,5 @@ var threshold = +breaks[i]; // make sure it's a number

isolines.push(isoline);
results.push(isoline);
}
return isolines;
return results;
}

@@ -541,3 +544,3 @@

* @private
* @param {Array<MultiLineString>} isolines to be rescaled
* @param {Array<MultiLineString>} createdIsoLines to be rescaled
* @param {Array<Array<number>>} matrix Grid Data

@@ -547,3 +550,3 @@ * @param {Object} points Points by Latitude

*/
function rescaleIsolines(isolines, matrix, points) {
function rescaleIsolines(createdIsoLines, matrix, points) {

@@ -572,7 +575,7 @@ // get dimensions (on the map) of the original grid

// resize and shift each point/line of the isolines
isolines.forEach(function (isoline) {
// resize and shift each point/line of the createdIsoLines
createdIsoLines.forEach(function (isoline) {
meta.coordEach(isoline, resize);
});
return isolines;
return createdIsoLines;
}

@@ -579,0 +582,0 @@

{
"name": "@turf/isolines",
"version": "5.0.4",
"version": "5.0.5",
"description": "turf isolines module",
"main": "main",
"module": "index",
"jsnext:main": "index",
"main": "main.js",
"module": "main.mjs",
"types": "index.d.ts",

@@ -13,3 +12,4 @@ "files": [

"main.js",
"lib"
"lib",
"main.mjs"
],

@@ -19,3 +19,4 @@ "scripts": {

"test": "node -r @std/esm test.js",
"bench": "node -r @std/esm bench.js"
"bench": "node -r @std/esm bench.js",
"docs": "node ../../scripts/generate-readmes"
},

@@ -45,7 +46,7 @@ "repository": {

"@std/esm": "*",
"@turf/envelope": "^5.0.4",
"@turf/point-grid": "^5.0.4",
"@turf/random": "^5.0.4",
"@turf/rhumb-destination": "^5.0.4",
"@turf/truncate": "^5.0.4",
"@turf/envelope": "*",
"@turf/point-grid": "*",
"@turf/random": "*",
"@turf/rhumb-destination": "*",
"@turf/truncate": "*",
"benchmark": "*",

@@ -56,3 +57,4 @@ "load-json-file": "*",

"tape": "*",
"write-json-file": "*"
"write-json-file": "*",
"rollup-plugin-buble": "*"
},

@@ -59,0 +61,0 @@ "dependencies": {

@@ -7,3 +7,3 @@ # @turf/isolines

Takes a grid [FeatureCollection](http://geojson.org/geojson-spec.html#feature-collection-objects) of [Point](http://geojson.org/geojson-spec.html#point) features with z-values and an array of
Takes a grid [FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) of [Point](https://tools.ietf.org/html/rfc7946#section-3.1.2) features with z-values and an array of
value breaks and generates [isolines](http://en.wikipedia.org/wiki/Isoline).

@@ -13,3 +13,3 @@

- `pointGrid` **[FeatureCollection](http://geojson.org/geojson-spec.html#feature-collection-objects)&lt;[Point](http://geojson.org/geojson-spec.html#point)>** input points
- `pointGrid` **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)&lt;[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)>** input points
- `breaks` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>** values of `zProperty` where to draw isolines

@@ -40,3 +40,3 @@ - `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Optional parameters (optional, default `{}`)

Returns **[FeatureCollection](http://geojson.org/geojson-spec.html#feature-collection-objects)&lt;[MultiLineString](http://geojson.org/geojson-spec.html#multilinestring)>** a FeatureCollection of [MultiLineString](http://geojson.org/geojson-spec.html#multilinestring) features representing isolines
Returns **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)&lt;[MultiLineString](https://tools.ietf.org/html/rfc7946#section-3.1.5)>** a FeatureCollection of [MultiLineString](https://tools.ietf.org/html/rfc7946#section-3.1.5) features representing isolines

@@ -43,0 +43,0 @@ <!-- This file is automatically generated. Please don't edit it directly:

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