mapshaper 0.6.50 → 0.6.51

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/mapshaper.js CHANGED
@@ -1,6 +1,6 @@
1
1
  (function () {
2
2
 
3
- var VERSION = "0.6.50";
3
+ var VERSION = "0.6.51";
4
4
 
5
5
 
6
6
  var utils = /*#__PURE__*/Object.freeze({
@@ -11259,12 +11259,6 @@
11259
11259
  return ss && ss.isFile() || false;
11260
11260
  };
11261
11261
 
11262
- cli.checkCommandEnv = function(cname) {
11263
- var blocked = ['i', 'include', 'require', 'external'];
11264
- if (runningInBrowser() && blocked.includes(cname)) {
11265
- stop('The -' + cname + ' command cannot be run in the browser');
11266
- }
11267
- };
11268
11262
 
11269
11263
  // cli.fileSize = function(path) {
11270
11264
  // var ss = cli.statSync(path);
@@ -24366,12 +24360,12 @@ ${svg}
24366
24360
  describe: 'side length (e.g. 500m, 12km)',
24367
24361
  type: 'distance'
24368
24362
  })
24369
- // .option('cols', {
24370
- // type: 'integer'
24371
- // })
24372
- // .option('rows', {
24373
- // type: 'integer'
24374
- // })
24363
+ .option('cols', {
24364
+ type: 'integer'
24365
+ })
24366
+ .option('rows', {
24367
+ type: 'integer'
24368
+ })
24375
24369
  // .option('bbox', {
24376
24370
  // type: 'bbox',
24377
24371
  // describe: 'xmin,ymin,xmax,ymax (default is bbox of data)'
@@ -28106,7 +28100,6 @@ ${svg}
28106
28100
  var files = opts.files || [];
28107
28101
  var dataset;
28108
28102
 
28109
- cli.checkCommandEnv('i');
28110
28103
  if (opts.stdin) {
28111
28104
  dataset = importFile('/dev/stdin', opts);
28112
28105
  catalog.addDataset(dataset);
@@ -35478,8 +35471,15 @@ ${svg}
35478
35471
  // Returns array of matching records in src table, or null if no matches
35479
35472
  //
35480
35473
  function joinTableToLayer(destLyr, src, join, opts) {
35481
- var dest = destLyr.data,
35482
- useDuplication = !!opts.duplication,
35474
+ var dest = destLyr.data;
35475
+
35476
+ if (src == dest) {
35477
+ // self-join... duplicate source records to prevent assignment problems
35478
+ // (in calc= expressions and possibly elsewhere)
35479
+ src = src.clone();
35480
+ }
35481
+
35482
+ var useDuplication = !!opts.duplication,
35483
35483
  srcRecords = src.getRecords(),
35484
35484
  destRecords = dest.getRecords(),
35485
35485
  prefix = opts.prefix || '',
@@ -35495,7 +35495,7 @@ ${svg}
35495
35495
  retn = {},
35496
35496
  srcRec, srcId, destRec, joins, count, filter, calc, i, j, n, m;
35497
35497
 
35498
- // support for duplication of destination records
35498
+ // support for duplication of destination records for many-to-one joins
35499
35499
  var duplicateRecords, destShapes;
35500
35500
  if (useDuplication) {
35501
35501
  if (opts.calc) stop('duplication and calc options cannot be used together');
@@ -40658,6 +40658,19 @@ ${svg}
40658
40658
  // Currently the origin cell is always an "outie" (protruding); in the future
40659
40659
  // "innie" origin cells may be supported
40660
40660
 
40661
+ function getHexGridParams(bbox, interval, opts) {
40662
+ opts.type != 'hex2'; // hex2 is "pointy-top" orientation
40663
+
40664
+ // get origin and counts for centered grid
40665
+ // params.u0 = _getUOrigin();
40666
+ // params.v0 = _getVOrigin();
40667
+ // params.colCounts = _getColCounts(bbox, interval);
40668
+ // params.rowCounts = _getRowCounts(bbox, interval);
40669
+
40670
+ if (opts.aligned) ;
40671
+ }
40672
+
40673
+
40661
40674
  // interval: side length in projected coordinates
40662
40675
  // bbox: bounding box of area to be enclosed by grid
40663
40676
  //
@@ -40672,6 +40685,8 @@ ${svg}
40672
40685
  var _uOrigin = _getUOrigin();
40673
40686
  var _vOrigin = _getVOrigin();
40674
40687
 
40688
+ getHexGridParams(bbox, interval, opts);
40689
+
40675
40690
  function cells() {
40676
40691
  return _rowCounts[0] * _colCounts[0] + _rowCounts[1] * _colCounts[1];
40677
40692
  }
@@ -41821,7 +41836,9 @@ ${svg}
41821
41836
  var str = standardizeConsoleCommands(raw);
41822
41837
  var parsed = parseCommands(str);
41823
41838
  parsed.forEach(function(cmd) {
41824
- cli.checkCommandEnv(cmd.name);
41839
+ if (['i', 'include', 'require', 'external'].includes(cmd.name)) {
41840
+ stop('The ' + cmd.name + ' command cannot be run in the web console.');
41841
+ }
41825
41842
  });
41826
41843
  return parsed;
41827
41844
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mapshaper",
3
- "version": "0.6.50",
3
+ "version": "0.6.51",
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.6.50";
3
+ var VERSION = "0.6.51";
4
4
 
5
5
 
6
6
  var utils = /*#__PURE__*/Object.freeze({
@@ -11259,12 +11259,6 @@
11259
11259
  return ss && ss.isFile() || false;
11260
11260
  };
11261
11261
 
11262
- cli.checkCommandEnv = function(cname) {
11263
- var blocked = ['i', 'include', 'require', 'external'];
11264
- if (runningInBrowser() && blocked.includes(cname)) {
11265
- stop('The -' + cname + ' command cannot be run in the browser');
11266
- }
11267
- };
11268
11262
 
11269
11263
  // cli.fileSize = function(path) {
11270
11264
  // var ss = cli.statSync(path);
@@ -24366,12 +24360,12 @@ ${svg}
24366
24360
  describe: 'side length (e.g. 500m, 12km)',
24367
24361
  type: 'distance'
24368
24362
  })
24369
- // .option('cols', {
24370
- // type: 'integer'
24371
- // })
24372
- // .option('rows', {
24373
- // type: 'integer'
24374
- // })
24363
+ .option('cols', {
24364
+ type: 'integer'
24365
+ })
24366
+ .option('rows', {
24367
+ type: 'integer'
24368
+ })
24375
24369
  // .option('bbox', {
24376
24370
  // type: 'bbox',
24377
24371
  // describe: 'xmin,ymin,xmax,ymax (default is bbox of data)'
@@ -28106,7 +28100,6 @@ ${svg}
28106
28100
  var files = opts.files || [];
28107
28101
  var dataset;
28108
28102
 
28109
- cli.checkCommandEnv('i');
28110
28103
  if (opts.stdin) {
28111
28104
  dataset = importFile('/dev/stdin', opts);
28112
28105
  catalog.addDataset(dataset);
@@ -35478,8 +35471,15 @@ ${svg}
35478
35471
  // Returns array of matching records in src table, or null if no matches
35479
35472
  //
35480
35473
  function joinTableToLayer(destLyr, src, join, opts) {
35481
- var dest = destLyr.data,
35482
- useDuplication = !!opts.duplication,
35474
+ var dest = destLyr.data;
35475
+
35476
+ if (src == dest) {
35477
+ // self-join... duplicate source records to prevent assignment problems
35478
+ // (in calc= expressions and possibly elsewhere)
35479
+ src = src.clone();
35480
+ }
35481
+
35482
+ var useDuplication = !!opts.duplication,
35483
35483
  srcRecords = src.getRecords(),
35484
35484
  destRecords = dest.getRecords(),
35485
35485
  prefix = opts.prefix || '',
@@ -35495,7 +35495,7 @@ ${svg}
35495
35495
  retn = {},
35496
35496
  srcRec, srcId, destRec, joins, count, filter, calc, i, j, n, m;
35497
35497
 
35498
- // support for duplication of destination records
35498
+ // support for duplication of destination records for many-to-one joins
35499
35499
  var duplicateRecords, destShapes;
35500
35500
  if (useDuplication) {
35501
35501
  if (opts.calc) stop('duplication and calc options cannot be used together');
@@ -40658,6 +40658,19 @@ ${svg}
40658
40658
  // Currently the origin cell is always an "outie" (protruding); in the future
40659
40659
  // "innie" origin cells may be supported
40660
40660
 
40661
+ function getHexGridParams(bbox, interval, opts) {
40662
+ opts.type != 'hex2'; // hex2 is "pointy-top" orientation
40663
+
40664
+ // get origin and counts for centered grid
40665
+ // params.u0 = _getUOrigin();
40666
+ // params.v0 = _getVOrigin();
40667
+ // params.colCounts = _getColCounts(bbox, interval);
40668
+ // params.rowCounts = _getRowCounts(bbox, interval);
40669
+
40670
+ if (opts.aligned) ;
40671
+ }
40672
+
40673
+
40661
40674
  // interval: side length in projected coordinates
40662
40675
  // bbox: bounding box of area to be enclosed by grid
40663
40676
  //
@@ -40672,6 +40685,8 @@ ${svg}
40672
40685
  var _uOrigin = _getUOrigin();
40673
40686
  var _vOrigin = _getVOrigin();
40674
40687
 
40688
+ getHexGridParams(bbox, interval, opts);
40689
+
40675
40690
  function cells() {
40676
40691
  return _rowCounts[0] * _colCounts[0] + _rowCounts[1] * _colCounts[1];
40677
40692
  }
@@ -41821,7 +41836,9 @@ ${svg}
41821
41836
  var str = standardizeConsoleCommands(raw);
41822
41837
  var parsed = parseCommands(str);
41823
41838
  parsed.forEach(function(cmd) {
41824
- cli.checkCommandEnv(cmd.name);
41839
+ if (['i', 'include', 'require', 'external'].includes(cmd.name)) {
41840
+ stop('The ' + cmd.name + ' command cannot be run in the web console.');
41841
+ }
41825
41842
  });
41826
41843
  return parsed;
41827
41844
  }