Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vega-geo

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vega-geo - npm Package Compare versions

Comparing version 3.0.0 to 3.1.0

.travis.yml

4

build/vega-geo.js

@@ -8,3 +8,3 @@ (function (global, factory) {

var CONTOUR_PARAMS = ['size', 'smooth'];
var DENSITY_PARAMS = ['x', 'y', 'size', 'cellSize', 'bandwidth'];
var DENSITY_PARAMS = ['x', 'y', 'weight', 'size', 'cellSize', 'bandwidth'];

@@ -24,2 +24,3 @@ /**

* @param {function(object): number} [params.y] - The pixel y-coordinate accessor for density estimation.
* @param {function(object): number} [params.weight] - The data point weight accessor for density estimation.
* @param {number} [params.cellSize] - Contour density calculation cell size.

@@ -50,2 +51,3 @@ * @param {number} [params.bandwidth] - Kernel density estimation bandwidth.

{ "name": "y", "type": "field" },
{ "name": "weight", "type": "field" },
{ "name": "cellSize", "type": "number" },

@@ -52,0 +54,0 @@ { "name": "bandwidth", "type": "number" },

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vega-dataflow"),require("vega-util"),require("d3-array"),require("d3-contour"),require("vega-projection"),require("d3-geo")):"function"==typeof define&&define.amd?define(["exports","vega-dataflow","vega-util","d3-array","d3-contour","vega-projection","d3-geo"],t):t((e.vega=e.vega||{},e.vega.transforms={}),e.vega,e.vega,e.d3,e.d3,e.vega,e.d3)}(this,function(e,u,d,f,l,p,t){"use strict";var m=["size","smooth"],c=["x","y","size","cellSize","bandwidth"];function n(e){u.Transform.call(this,null,e)}n.Definition={type:"Contour",metadata:{generates:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"values",type:"number",array:!0},{name:"x",type:"field"},{name:"y",type:"field"},{name:"cellSize",type:"number"},{name:"bandwidth",type:"number"},{name:"count",type:"number"},{name:"smooth",type:"boolean"},{name:"nice",type:"boolean",default:!1},{name:"thresholds",type:"number",array:!0}]},d.inherits(n,u.Transform).transform=function(t,e){if(this.value&&!e.changed()&&!t.modified())return e.StopPropagation;var n,i,r,o,a=e.fork(e.NO_SOURCE|e.NO_FIELDS),s=t.count||10;return t.values?(n=l.contours(),i=m,r=t.values):(n=l.contourDensity(),i=c,r=e.materialize(e.SOURCE).source),n.thresholds(t.thresholds||(t.nice?s:(o=s,function(e){for(var t=f.extent(e),n=t[0],i=t[1]-n,r=[],a=1;a<=o;++a)r.push(n+i*a/(o+1));return r}))),i.forEach(function(e){null!=t[e]&&n[e](t[e])}),this.value&&(a.rem=this.value),r=r&&r.length?n(r).map(u.ingest):[],this.value=a.source=a.add=r,a};var h="FeatureCollection";function i(e){u.Transform.call(this,null,e)}function r(e){u.Transform.call(this,null,e)}function a(e){u.Transform.call(this,null,e)}function o(e){u.Transform.call(this,null,e)}function s(e){u.Transform.call(this,[],e),this.generator=t.geoGraticule()}function y(e){u.Transform.call(this,null,e),this.modified(!0)}function g(e,t,n){d.isFunction(e[t])&&e[t](n)}i.Definition={type:"GeoJSON",metadata:{},params:[{name:"fields",type:"field",array:!0,length:2},{name:"geojson",type:"field"}]},d.inherits(i,u.Transform).transform=function(e,t){var n,i=this._features,r=this._points,a=e.fields,o=a&&a[0],s=a&&a[1],u=e.geojson,f=t.ADD;n=e.modified()||t.changed(t.REM)||t.modified(d.accessorFields(u))||o&&t.modified(d.accessorFields(o))||s&&t.modified(d.accessorFields(s)),this.value&&!n||(f=t.SOURCE,this._features=i=[],this._points=r=[]),u&&t.visit(f,function(e){i.push(u(e))}),o&&s&&(t.visit(f,function(e){var t=o(e),n=s(e);null!=t&&null!=n&&(t=+t)===t&&(n=+n)===n&&r.push([t,n])}),i=i.concat({type:"Feature",geometry:{type:"MultiPoint",coordinates:r}})),this.value={type:h,features:i}},r.Definition={type:"GeoPath",metadata:{modifies:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"path"}]},d.inherits(r,u.Transform).transform=function(e,t){var n=t.fork(t.ALL),i=this.value,r=e.field||d.identity,a=e.as||"path",o=n.SOURCE;!i||e.modified()?(this.value=i=p.getProjectionPath(e.projection),n.materialize().reflow()):o=r===d.identity||t.modified(r.fields)?n.ADD_MOD:n.ADD;var s=function(e,t){var n=e.pointRadius();e.context(null),null!=t&&e.pointRadius(t);return n}(i,e.pointRadius);return n.visit(o,function(e){e[a]=i(r(e))}),i.pointRadius(s),n.modifies(a)},a.Definition={type:"GeoPoint",metadata:{modifies:!0},params:[{name:"projection",type:"projection",required:!0},{name:"fields",type:"field",array:!0,required:!0,length:2},{name:"as",type:"string",array:!0,length:2,default:["x","y"]}]},d.inherits(a,u.Transform).transform=function(e,t){var n,i=e.projection,r=e.fields[0],a=e.fields[1],o=e.as||["x","y"],s=o[0],u=o[1];function f(e){var t=i([r(e),a(e)]);t?(e[s]=t[0],e[u]=t[1]):(e[s]=void 0,e[u]=void 0)}return e.modified()?t=t.materialize().reflow(!0).visit(t.SOURCE,f):(n=t.modified(r.fields)||t.modified(a.fields),t.visit(n?t.ADD_MOD:t.ADD,f)),t.modifies(o)},o.Definition={type:"GeoShape",metadata:{modifies:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field",default:"datum"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"shape"}]},d.inherits(o,u.Transform).transform=function(e,t){var i,r,a,n,o=t.fork(t.ALL),s=this.value,u=e.field||d.field("datum"),f=e.as||"shape",l=o.ADD_MOD;return s&&!e.modified()||(this.value=(i=p.getProjectionPath(e.projection),r=u,a=e.pointRadius,(n=null==a?function(e){return i(r(e))}:function(e){var t=i.pointRadius(),n=i.pointRadius(a)(r(e));return i.pointRadius(t),n}).context=function(e){return i.context(e),n},s=n),o.materialize().reflow(),l=o.SOURCE),o.visit(l,function(e){e[f]=s}),o.modifies(f)},s.Definition={type:"Graticule",metadata:{changes:!0},params:[{name:"extent",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMajor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMinor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"step",type:"number",array:!0,length:2},{name:"stepMajor",type:"number",array:!0,length:2,default:[90,360]},{name:"stepMinor",type:"number",array:!0,length:2,default:[10,10]},{name:"precision",type:"number",default:2.5}]},d.inherits(s,u.Transform).transform=function(e,t){var n,i=this.value,r=this.generator;if(!i.length||e.modified())for(var a in e)d.isFunction(r[a])&&r[a](e[a]);return n=r(),i.length?t.mod.push(u.replace(i[0],n)):t.add.push(u.ingest(n)),i[0]=n,t},d.inherits(y,u.Transform).transform=function(t,e){var n,i,r,a,o=this.value;return!o||t.modified("type")?(this.value=o=function(e){var t=p.projection((e||"mercator").toLowerCase());t||d.error("Unrecognized projection type: "+e);return t()}(t.type),p.projectionProperties.forEach(function(e){null!=t[e]&&g(o,e,t[e])})):p.projectionProperties.forEach(function(e){t.modified(e)&&g(o,e,t[e])}),null!=t.pointRadius&&o.path.pointRadius(t.pointRadius),t.fit&&(n=o,a=(i=t).fit,r=1===(a=d.array(a)).length?a[0]:{type:h,features:a.reduce(function(e,t){return t&&t.type===h?e.push.apply(e,t.features):d.isArray(t)?e.push.apply(e,t):e.push(t),e},[])},i.extent?n.fitExtent(i.extent,r):i.size&&n.fitSize(i.size,r)),e.fork(e.NO_SOURCE|e.NO_FIELDS)},e.contour=n,e.geojson=i,e.geopath=r,e.geopoint=a,e.geoshape=o,e.graticule=s,e.projection=y,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vega-dataflow"),require("vega-util"),require("d3-array"),require("d3-contour"),require("vega-projection"),require("d3-geo")):"function"==typeof define&&define.amd?define(["exports","vega-dataflow","vega-util","d3-array","d3-contour","vega-projection","d3-geo"],t):t((e.vega=e.vega||{},e.vega.transforms={}),e.vega,e.vega,e.d3,e.d3,e.vega,e.d3)}(this,function(e,u,d,f,l,p,t){"use strict";var m=["size","smooth"],c=["x","y","weight","size","cellSize","bandwidth"];function n(e){u.Transform.call(this,null,e)}n.Definition={type:"Contour",metadata:{generates:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"values",type:"number",array:!0},{name:"x",type:"field"},{name:"y",type:"field"},{name:"weight",type:"field"},{name:"cellSize",type:"number"},{name:"bandwidth",type:"number"},{name:"count",type:"number"},{name:"smooth",type:"boolean"},{name:"nice",type:"boolean",default:!1},{name:"thresholds",type:"number",array:!0}]},d.inherits(n,u.Transform).transform=function(t,e){if(this.value&&!e.changed()&&!t.modified())return e.StopPropagation;var n,i,r,o,a=e.fork(e.NO_SOURCE|e.NO_FIELDS),s=t.count||10;return t.values?(n=l.contours(),i=m,r=t.values):(n=l.contourDensity(),i=c,r=e.materialize(e.SOURCE).source),n.thresholds(t.thresholds||(t.nice?s:(o=s,function(e){for(var t=f.extent(e),n=t[0],i=t[1]-n,r=[],a=1;a<=o;++a)r.push(n+i*a/(o+1));return r}))),i.forEach(function(e){null!=t[e]&&n[e](t[e])}),this.value&&(a.rem=this.value),r=r&&r.length?n(r).map(u.ingest):[],this.value=a.source=a.add=r,a};var h="FeatureCollection";function i(e){u.Transform.call(this,null,e)}function r(e){u.Transform.call(this,null,e)}function a(e){u.Transform.call(this,null,e)}function o(e){u.Transform.call(this,null,e)}function s(e){u.Transform.call(this,[],e),this.generator=t.geoGraticule()}function y(e){u.Transform.call(this,null,e),this.modified(!0)}function g(e,t,n){d.isFunction(e[t])&&e[t](n)}i.Definition={type:"GeoJSON",metadata:{},params:[{name:"fields",type:"field",array:!0,length:2},{name:"geojson",type:"field"}]},d.inherits(i,u.Transform).transform=function(e,t){var n,i=this._features,r=this._points,a=e.fields,o=a&&a[0],s=a&&a[1],u=e.geojson,f=t.ADD;n=e.modified()||t.changed(t.REM)||t.modified(d.accessorFields(u))||o&&t.modified(d.accessorFields(o))||s&&t.modified(d.accessorFields(s)),this.value&&!n||(f=t.SOURCE,this._features=i=[],this._points=r=[]),u&&t.visit(f,function(e){i.push(u(e))}),o&&s&&(t.visit(f,function(e){var t=o(e),n=s(e);null!=t&&null!=n&&(t=+t)===t&&(n=+n)===n&&r.push([t,n])}),i=i.concat({type:"Feature",geometry:{type:"MultiPoint",coordinates:r}})),this.value={type:h,features:i}},r.Definition={type:"GeoPath",metadata:{modifies:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"path"}]},d.inherits(r,u.Transform).transform=function(e,t){var n=t.fork(t.ALL),i=this.value,r=e.field||d.identity,a=e.as||"path",o=n.SOURCE;!i||e.modified()?(this.value=i=p.getProjectionPath(e.projection),n.materialize().reflow()):o=r===d.identity||t.modified(r.fields)?n.ADD_MOD:n.ADD;var s=function(e,t){var n=e.pointRadius();e.context(null),null!=t&&e.pointRadius(t);return n}(i,e.pointRadius);return n.visit(o,function(e){e[a]=i(r(e))}),i.pointRadius(s),n.modifies(a)},a.Definition={type:"GeoPoint",metadata:{modifies:!0},params:[{name:"projection",type:"projection",required:!0},{name:"fields",type:"field",array:!0,required:!0,length:2},{name:"as",type:"string",array:!0,length:2,default:["x","y"]}]},d.inherits(a,u.Transform).transform=function(e,t){var n,i=e.projection,r=e.fields[0],a=e.fields[1],o=e.as||["x","y"],s=o[0],u=o[1];function f(e){var t=i([r(e),a(e)]);t?(e[s]=t[0],e[u]=t[1]):(e[s]=void 0,e[u]=void 0)}return e.modified()?t=t.materialize().reflow(!0).visit(t.SOURCE,f):(n=t.modified(r.fields)||t.modified(a.fields),t.visit(n?t.ADD_MOD:t.ADD,f)),t.modifies(o)},o.Definition={type:"GeoShape",metadata:{modifies:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field",default:"datum"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"shape"}]},d.inherits(o,u.Transform).transform=function(e,t){var i,r,a,n,o=t.fork(t.ALL),s=this.value,u=e.field||d.field("datum"),f=e.as||"shape",l=o.ADD_MOD;return s&&!e.modified()||(this.value=(i=p.getProjectionPath(e.projection),r=u,a=e.pointRadius,(n=null==a?function(e){return i(r(e))}:function(e){var t=i.pointRadius(),n=i.pointRadius(a)(r(e));return i.pointRadius(t),n}).context=function(e){return i.context(e),n},s=n),o.materialize().reflow(),l=o.SOURCE),o.visit(l,function(e){e[f]=s}),o.modifies(f)},s.Definition={type:"Graticule",metadata:{changes:!0},params:[{name:"extent",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMajor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMinor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"step",type:"number",array:!0,length:2},{name:"stepMajor",type:"number",array:!0,length:2,default:[90,360]},{name:"stepMinor",type:"number",array:!0,length:2,default:[10,10]},{name:"precision",type:"number",default:2.5}]},d.inherits(s,u.Transform).transform=function(e,t){var n,i=this.value,r=this.generator;if(!i.length||e.modified())for(var a in e)d.isFunction(r[a])&&r[a](e[a]);return n=r(),i.length?t.mod.push(u.replace(i[0],n)):t.add.push(u.ingest(n)),i[0]=n,t},d.inherits(y,u.Transform).transform=function(t,e){var n,i,r,a,o=this.value;return!o||t.modified("type")?(this.value=o=function(e){var t=p.projection((e||"mercator").toLowerCase());t||d.error("Unrecognized projection type: "+e);return t()}(t.type),p.projectionProperties.forEach(function(e){null!=t[e]&&g(o,e,t[e])})):p.projectionProperties.forEach(function(e){t.modified(e)&&g(o,e,t[e])}),null!=t.pointRadius&&o.path.pointRadius(t.pointRadius),t.fit&&(n=o,a=(i=t).fit,r=1===(a=d.array(a)).length?a[0]:{type:h,features:a.reduce(function(e,t){return t&&t.type===h?e.push.apply(e,t.features):d.isArray(t)?e.push.apply(e,t):e.push(t),e},[])},i.extent?n.fitExtent(i.extent,r):i.size&&n.fitSize(i.size,r)),e.fork(e.NO_SOURCE|e.NO_FIELDS)},e.contour=n,e.geojson=i,e.geopath=r,e.geopoint=a,e.geoshape=o,e.graticule=s,e.projection=y,Object.defineProperty(e,"__esModule",{value:!0})});
{
"name": "vega-geo",
"version": "3.0.0",
"version": "3.1.0",
"description": "Geographic data transforms for Vega dataflows.",

@@ -27,3 +27,3 @@ "keywords": [

"test": "tape 'test/**/*-test.js' && eslint index.js src test",
"prepublish": "npm run build",
"prepublishOnly": "npm run build",
"postpublish": "git push && git push --tags && zip -j build/vega-geo.zip -- LICENSE README.md build/vega-geo.js build/vega-geo.min.js"

@@ -33,6 +33,6 @@ },

"d3-array": "^1.2.1",
"d3-contour": "^1.2.0",
"d3-contour": "^1.3.0",
"d3-geo": "^1.10.0",
"vega-dataflow": "^4.0.0",
"vega-projection": "^1.1.0",
"vega-dataflow": "^4.0.3",
"vega-projection": "^1.2.0",
"vega-util": "^1.7.0"

@@ -42,7 +42,7 @@ },

"eslint": "4",
"rollup": "0.58.2",
"rollup": "0.60.7",
"tape": "4",
"uglify-js": "3",
"vega-transforms": "^2.0.0"
"vega-transforms": "^2.1.0"
}
}

@@ -7,3 +7,3 @@ import {ingest, Transform} from 'vega-dataflow';

var CONTOUR_PARAMS = ['size', 'smooth'];
var DENSITY_PARAMS = ['x', 'y', 'size', 'cellSize', 'bandwidth'];
var DENSITY_PARAMS = ['x', 'y', 'weight', 'size', 'cellSize', 'bandwidth'];

@@ -23,2 +23,3 @@ /**

* @param {function(object): number} [params.y] - The pixel y-coordinate accessor for density estimation.
* @param {function(object): number} [params.weight] - The data point weight accessor for density estimation.
* @param {number} [params.cellSize] - Contour density calculation cell size.

@@ -49,2 +50,3 @@ * @param {number} [params.bandwidth] - Kernel density estimation bandwidth.

{ "name": "y", "type": "field" },
{ "name": "weight", "type": "field" },
{ "name": "cellSize", "type": "number" },

@@ -51,0 +53,0 @@ { "name": "bandwidth", "type": "number" },

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