mapshaper 0.6.34 → 0.6.35

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.34";
3
+ var VERSION = "0.6.35";
4
4
 
5
5
 
6
6
  var utils = /*#__PURE__*/Object.freeze({
@@ -12719,7 +12719,7 @@
12719
12719
  }
12720
12720
  var sliverControl = opts.sliver_control >= 0 ? opts.sliver_control : 0; // 0 is default
12721
12721
  var crs = getDatasetCRS(dataset);
12722
- var threshold = areaArg ?
12722
+ var threshold = areaArg && areaArg != 'auto' ?
12723
12723
  convertAreaParam(areaArg, crs) :
12724
12724
  getDefaultSliverThreshold(lyr, dataset.arcs);
12725
12725
  var filter = sliverControl > 0 ?
@@ -16653,7 +16653,8 @@
16653
16653
  overlap_rule: opts.overlap_rule
16654
16654
  };
16655
16655
  var mosaicIndex = new MosaicIndex(lyr, nodes, mosaicOpts);
16656
- var fillGaps = !opts.allow_overlaps; // gap fill doesn't work yet with overlapping shapes
16656
+ // gap fill doesn't work yet with overlapping shapes
16657
+ var fillGaps = !opts.allow_overlaps && (opts.sliver_control || opts.gap_fill_area);
16657
16658
  var cleanupData, filterData;
16658
16659
  if (fillGaps) {
16659
16660
  var sliverOpts = utils.extend({sliver_control: 1}, opts);
@@ -16935,6 +16936,7 @@
16935
16936
 
16936
16937
  function cleanPolygonLayerGeometry(lyr, dataset, opts) {
16937
16938
  // clean polygons by apply the 'dissolve2' function to each feature
16939
+ opts = Object.assign({gap_fill_area: 'auto'}, opts);
16938
16940
  var groups = lyr.shapes.map(function(shp, i) {
16939
16941
  return [i];
16940
16942
  });
@@ -23698,7 +23700,10 @@ ${svg}
23698
23700
  .option('calc', calcOpt)
23699
23701
  .option('sum-fields', sumFieldsOpt)
23700
23702
  .option('copy-fields', copyFieldsOpt)
23701
- .option('gap-fill-area', minGapAreaOpt)
23703
+ .option('gap-fill-area', {
23704
+ describe: 'threshold for filling gaps, e.g. 1.5km2',
23705
+ type: 'area'
23706
+ })
23702
23707
  .option('sliver-control', sliverControlOpt)
23703
23708
  .option('allow-overlaps', {
23704
23709
  describe: 'allow dissolved polygons to overlap (disables gap fill)',
@@ -40133,6 +40138,7 @@ ${svg}
40133
40138
  };
40134
40139
 
40135
40140
  if (opts.calc) {
40141
+ if (!lyr.data) initDataTable(lyr);
40136
40142
  records2 = recombineDataRecords(lyr.data.getRecords(), mosaicIndex.getSourceIdsByTileId, mosaicShapes.length, opts);
40137
40143
  lyr2.data = new DataTable(records2);
40138
40144
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mapshaper",
3
- "version": "0.6.34",
3
+ "version": "0.6.35",
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.34";
3
+ var VERSION = "0.6.35";
4
4
 
5
5
 
6
6
  var utils = /*#__PURE__*/Object.freeze({
@@ -12719,7 +12719,7 @@
12719
12719
  }
12720
12720
  var sliverControl = opts.sliver_control >= 0 ? opts.sliver_control : 0; // 0 is default
12721
12721
  var crs = getDatasetCRS(dataset);
12722
- var threshold = areaArg ?
12722
+ var threshold = areaArg && areaArg != 'auto' ?
12723
12723
  convertAreaParam(areaArg, crs) :
12724
12724
  getDefaultSliverThreshold(lyr, dataset.arcs);
12725
12725
  var filter = sliverControl > 0 ?
@@ -16653,7 +16653,8 @@
16653
16653
  overlap_rule: opts.overlap_rule
16654
16654
  };
16655
16655
  var mosaicIndex = new MosaicIndex(lyr, nodes, mosaicOpts);
16656
- var fillGaps = !opts.allow_overlaps; // gap fill doesn't work yet with overlapping shapes
16656
+ // gap fill doesn't work yet with overlapping shapes
16657
+ var fillGaps = !opts.allow_overlaps && (opts.sliver_control || opts.gap_fill_area);
16657
16658
  var cleanupData, filterData;
16658
16659
  if (fillGaps) {
16659
16660
  var sliverOpts = utils.extend({sliver_control: 1}, opts);
@@ -16935,6 +16936,7 @@
16935
16936
 
16936
16937
  function cleanPolygonLayerGeometry(lyr, dataset, opts) {
16937
16938
  // clean polygons by apply the 'dissolve2' function to each feature
16939
+ opts = Object.assign({gap_fill_area: 'auto'}, opts);
16938
16940
  var groups = lyr.shapes.map(function(shp, i) {
16939
16941
  return [i];
16940
16942
  });
@@ -23698,7 +23700,10 @@ ${svg}
23698
23700
  .option('calc', calcOpt)
23699
23701
  .option('sum-fields', sumFieldsOpt)
23700
23702
  .option('copy-fields', copyFieldsOpt)
23701
- .option('gap-fill-area', minGapAreaOpt)
23703
+ .option('gap-fill-area', {
23704
+ describe: 'threshold for filling gaps, e.g. 1.5km2',
23705
+ type: 'area'
23706
+ })
23702
23707
  .option('sliver-control', sliverControlOpt)
23703
23708
  .option('allow-overlaps', {
23704
23709
  describe: 'allow dissolved polygons to overlap (disables gap fill)',
@@ -40133,6 +40138,7 @@ ${svg}
40133
40138
  };
40134
40139
 
40135
40140
  if (opts.calc) {
40141
+ if (!lyr.data) initDataTable(lyr);
40136
40142
  records2 = recombineDataRecords(lyr.data.getRecords(), mosaicIndex.getSourceIdsByTileId, mosaicShapes.length, opts);
40137
40143
  lyr2.data = new DataTable(records2);
40138
40144
  }