Socket
Socket
Sign inDemoInstall

@planet/dynamic-tiles

Package Overview
Dependencies
Maintainers
7
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@planet/dynamic-tiles - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

57

maths.js

@@ -15,2 +15,3 @@ "use strict";

exports.lookupTableStyle = lookupTableStyle;
exports.applyBrightnessContrastSaturation = applyBrightnessContrastSaturation;
exports.levelsToCurve = exports.styleFuncs = void 0;

@@ -263,2 +264,58 @@

};
}
var matMult = function matMult(a, b) {
var c = [];
for (var i = 0; i < 4; i++) {
c[i] = new Array(4);
}
for (var y = 0; y < 4; y++) {
for (var x = 0; x < 4; x++) {
c[y][x] = b[y][0] * a[0][x] + b[y][1] * a[1][x] + b[y][2] * a[2][x] + b[y][3] * a[3][x];
}
}
return c;
};
var prepareBCSMat = function prepareBCSMat(brt, con, s) {
var brtm = [[brt, 0, 0, 0], [0, brt, 0, 0], [0, 0, brt, 0], [0, 0, 0, 1]];
var rwgt = 0.3086;
var gwgt = 0.6094;
var bwgt = 0.082;
var a = (1.0 - s) * rwgt + s;
var b = (1.0 - s) * rwgt;
var c = (1.0 - s) * rwgt;
var d = (1.0 - s) * gwgt;
var e = (1.0 - s) * gwgt + s;
var f = (1.0 - s) * gwgt;
var g = (1.0 - s) * bwgt;
var h = (1.0 - s) * bwgt;
var i = (1.0 - s) * bwgt + s;
var satm = [[a, b, c, 0.0], [d, e, f, 0.0], [g, h, i, 0.0], [0.0, 0.0, 0.0, 1.0]];
var conm = [[1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [con, con, con, 1.0]];
return matMult(matMult(brtm, conm), satm);
}; // adopted from http://www.graficaobscura.com/matrix/index.html
// note: an attempt was made to use the approach taken in the webgl pixel shader
// but this did not yield equal results and was significantly slower in doing
// so...
// @revisit as the algorithm notes, this approach expects a linear color space
// does this need an srgb conversion or is adequate as-is?
function applyBrightnessContrastSaturation(brt, con, s) {
var mat = prepareBCSMat(brt, con, s);
return function (px) {
var r = px[0];
var g = px[1];
var b = px[2];
px[0] = r * mat[0][0] + g * mat[1][0] + b * mat[2][0] + mat[3][0];
px[1] = r * mat[0][1] + g * mat[1][1] + b * mat[2][1] + mat[3][1];
px[2] = r * mat[0][2] + g * mat[1][2] + b * mat[2][2] + mat[3][2]; // note - we're taking advantage of receiver of pix using a clamped uint8
// to handle min/max of 0, 255
return px;
};
}

5

NumpySource.js

@@ -314,4 +314,2 @@ "use strict";

var histogram = null;
var c = 0;
var n = 0;
this.forEachTileInExtent(view.calculateExtent(), zoom, function (tile) {

@@ -322,6 +320,3 @@ var tileState = tile.getState();

histogram = (0, _maths.getHistogram)(tile, pxDepth, _this3.get('bands'), histogram);
c++;
}
n++;
});

@@ -328,0 +323,0 @@ return histogram;

2

package.json
{
"name": "@planet/dynamic-tiles",
"version": "1.0.1",
"version": "1.1.0",
"description": "Support for dynamically colored tiles from Planet Inc. tile servers.",

@@ -5,0 +5,0 @@ "main": "./ol.js",

@@ -23,2 +23,10 @@ "use strict";

function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }

@@ -216,2 +224,6 @@

if (options.bcs) {
fn.push(maths.applyBrightnessContrastSaturation.apply(maths, _toConsumableArray(options.bcs)));
}
var ii = fn.length; // each function will get the pixel data and the bandMaps

@@ -246,5 +258,3 @@

var bandData = bandOffset.map(function () {
return 0;
});
var bandData = new Array(nBands);

@@ -251,0 +261,0 @@ for (var b = 0; b < bandsize; b++) {

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