mapshaper 0.5.107 → 0.5.108

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,4 +1,4 @@
1
- v0.5.107
1
+ v0.5.108
2
2
  * Bug fixes
3
3
  * Added file_exists() to -if/-elif expressions
4
4
 
package/mapshaper.js CHANGED
@@ -1,6 +1,6 @@
1
1
  (function () {
2
2
 
3
- var VERSION = "0.5.103";
3
+ var VERSION = "0.5.108";
4
4
 
5
5
 
6
6
  var utils = /*#__PURE__*/Object.freeze({
@@ -1737,16 +1737,6 @@
1737
1737
 
1738
1738
  // Iterate over each [x,y] point in a layer
1739
1739
  // shapes: one layer's "shapes" array
1740
- function forEachPoint_(shapes, cb) {
1741
- var i, n, j, m, shp;
1742
- for (i=0, n=shapes.length; i<n; i++) {
1743
- shp = shapes[i];
1744
- for (j=0, m=shp ? shp.length : 0; j<m; j++) {
1745
- cb(shp[j], i);
1746
- }
1747
- }
1748
- }
1749
-
1750
1740
  function forEachPoint(shapes, cb) {
1751
1741
  var i, n, j, m, shp;
1752
1742
  for (i=0, n=shapes.length; i<n; i++) {
@@ -1763,7 +1753,6 @@
1763
1753
  getPointBounds: getPointBounds$1,
1764
1754
  getPointFeatureBounds: getPointFeatureBounds,
1765
1755
  getPointsInLayer: getPointsInLayer,
1766
- forEachPoint_: forEachPoint_,
1767
1756
  forEachPoint: forEachPoint
1768
1757
  });
1769
1758
 
@@ -9957,11 +9946,6 @@
9957
9946
  ctx.$ = i >= 0 ? getFeatureById(i) : layerOnlyProxy;
9958
9947
  ctx._ = ctx; // provide access to functions when masked by variable names
9959
9948
  ctx.d = rec || null; // expose data properties a la d3 (also exposed as this.properties)
9960
- if (opts.record_alias) {
9961
- // this is used to expose source table record as "source" in -join calc=
9962
- // expresions.
9963
- ctx[opts.record_alias] = ctx.d;
9964
- }
9965
9949
  try {
9966
9950
  val = func.call(ctx.$, rec, ctx);
9967
9951
  } catch(e) {
@@ -34663,24 +34647,19 @@ ${svg}
34663
34647
  return o;
34664
34648
  }
34665
34649
 
34666
- function compileIfCommandExpression(expr, catalog, target, opts) {
34667
- var ctx = {};
34668
-
34669
- if (target && target.layer) {
34670
- ctx = getLayerProxy(target.layer, target.dataset.arcs, opts);
34671
- }
34650
+ function compileIfCommandExpression(expr, catalog, targ, opts) {
34651
+ var ctx = getLayerProxy(targ.layer, targ.dataset.arcs, opts);
34652
+ var exprOpts = Object.assign({returns: true}, opts);
34653
+ var func = compileExpressionToFunction(expr, exprOpts);
34672
34654
 
34673
- ctx.file_exists = function(name) {
34674
- return cli.isFile(name);
34655
+ ctx.layer_exists = function(name) {
34656
+ return !!catalog.findSingleLayer(name);
34675
34657
  };
34676
34658
 
34677
- ctx.layer_exists = function(name) {
34678
- var lyr = catalog.findSingleLayer(name);
34679
- return !!lyr;
34659
+ ctx.file_exists = function(file) {
34660
+ return cli.isFile(file);
34680
34661
  };
34681
34662
 
34682
- var exprOpts = Object.assign({returns: true}, opts);
34683
- var func = compileExpressionToFunction(expr, exprOpts);
34684
34663
  return function() {
34685
34664
  try {
34686
34665
  return func.call(ctx, {}, ctx);
@@ -34689,7 +34668,6 @@ ${svg}
34689
34668
  stop(e.name, "in expression [" + expr + "]:", e.message);
34690
34669
  }
34691
34670
  };
34692
-
34693
34671
  }
34694
34672
 
34695
34673
  function skipCommand(cmdName) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mapshaper",
3
- "version": "0.5.107",
3
+ "version": "0.5.108",
4
4
  "description": "A tool for editing vector datasets for mapping and GIS.",
5
5
  "keywords": [
6
6
  "shapefile",
package/www/mapshaper.js CHANGED
@@ -1,6 +1,6 @@
1
1
  (function () {
2
2
 
3
- var VERSION = "0.5.103";
3
+ var VERSION = "0.5.108";
4
4
 
5
5
 
6
6
  var utils = /*#__PURE__*/Object.freeze({
@@ -1737,16 +1737,6 @@
1737
1737
 
1738
1738
  // Iterate over each [x,y] point in a layer
1739
1739
  // shapes: one layer's "shapes" array
1740
- function forEachPoint_(shapes, cb) {
1741
- var i, n, j, m, shp;
1742
- for (i=0, n=shapes.length; i<n; i++) {
1743
- shp = shapes[i];
1744
- for (j=0, m=shp ? shp.length : 0; j<m; j++) {
1745
- cb(shp[j], i);
1746
- }
1747
- }
1748
- }
1749
-
1750
1740
  function forEachPoint(shapes, cb) {
1751
1741
  var i, n, j, m, shp;
1752
1742
  for (i=0, n=shapes.length; i<n; i++) {
@@ -1763,7 +1753,6 @@
1763
1753
  getPointBounds: getPointBounds$1,
1764
1754
  getPointFeatureBounds: getPointFeatureBounds,
1765
1755
  getPointsInLayer: getPointsInLayer,
1766
- forEachPoint_: forEachPoint_,
1767
1756
  forEachPoint: forEachPoint
1768
1757
  });
1769
1758
 
@@ -9957,11 +9946,6 @@
9957
9946
  ctx.$ = i >= 0 ? getFeatureById(i) : layerOnlyProxy;
9958
9947
  ctx._ = ctx; // provide access to functions when masked by variable names
9959
9948
  ctx.d = rec || null; // expose data properties a la d3 (also exposed as this.properties)
9960
- if (opts.record_alias) {
9961
- // this is used to expose source table record as "source" in -join calc=
9962
- // expresions.
9963
- ctx[opts.record_alias] = ctx.d;
9964
- }
9965
9949
  try {
9966
9950
  val = func.call(ctx.$, rec, ctx);
9967
9951
  } catch(e) {
@@ -34663,24 +34647,19 @@ ${svg}
34663
34647
  return o;
34664
34648
  }
34665
34649
 
34666
- function compileIfCommandExpression(expr, catalog, target, opts) {
34667
- var ctx = {};
34668
-
34669
- if (target && target.layer) {
34670
- ctx = getLayerProxy(target.layer, target.dataset.arcs, opts);
34671
- }
34650
+ function compileIfCommandExpression(expr, catalog, targ, opts) {
34651
+ var ctx = getLayerProxy(targ.layer, targ.dataset.arcs, opts);
34652
+ var exprOpts = Object.assign({returns: true}, opts);
34653
+ var func = compileExpressionToFunction(expr, exprOpts);
34672
34654
 
34673
- ctx.file_exists = function(name) {
34674
- return cli.isFile(name);
34655
+ ctx.layer_exists = function(name) {
34656
+ return !!catalog.findSingleLayer(name);
34675
34657
  };
34676
34658
 
34677
- ctx.layer_exists = function(name) {
34678
- var lyr = catalog.findSingleLayer(name);
34679
- return !!lyr;
34659
+ ctx.file_exists = function(file) {
34660
+ return cli.isFile(file);
34680
34661
  };
34681
34662
 
34682
- var exprOpts = Object.assign({returns: true}, opts);
34683
- var func = compileExpressionToFunction(expr, exprOpts);
34684
34663
  return function() {
34685
34664
  try {
34686
34665
  return func.call(ctx, {}, ctx);
@@ -34689,7 +34668,6 @@ ${svg}
34689
34668
  stop(e.name, "in expression [" + expr + "]:", e.message);
34690
34669
  }
34691
34670
  };
34692
-
34693
34671
  }
34694
34672
 
34695
34673
  function skipCommand(cmdName) {