mapshaper 0.7.17 → 0.7.18

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
@@ -18650,14 +18650,14 @@
18650
18650
  var labelPositionFields = ['label-pos', 'dx', 'dy', 'text-anchor'];
18651
18651
 
18652
18652
  var labelPositionStyles = {
18653
- n: {dx: 0, dy: '-0.45em', 'text-anchor': 'middle'},
18654
- s: {dx: 0, dy: '1.05em', 'text-anchor': 'middle'},
18655
- e: {dx: '0.4em', dy: '0.25em', 'text-anchor': 'start'},
18656
- w: {dx: '-0.4em', dy: '0.25em', 'text-anchor': 'end'},
18657
- ne: {dx: '0.35em', dy: '-0.15em', 'text-anchor': 'start'},
18658
- se: {dx: '0.35em', dy: '0.7em', 'text-anchor': 'start'},
18659
- nw: {dx: '-0.35em', dy: '-0.15em', 'text-anchor': 'end'},
18660
- sw: {dx: '-0.35em', dy: '0.7em', 'text-anchor': 'end'},
18653
+ n: {dx: 0, dy: '-0.5em', 'text-anchor': 'middle'},
18654
+ s: {dx: 0, dy: '1.1em', 'text-anchor': 'middle'},
18655
+ e: {dx: '0.45em', dy: '0.23em', 'text-anchor': 'start'},
18656
+ w: {dx: '-0.45em', dy: '0.23em', 'text-anchor': 'end'},
18657
+ ne: {dx: '0.4em', dy: '-0.15em', 'text-anchor': 'start'},
18658
+ se: {dx: '0.4em', dy: '0.7em', 'text-anchor': 'start'},
18659
+ nw: {dx: '-0.4em', dy: '-0.15em', 'text-anchor': 'end'},
18660
+ sw: {dx: '-0.4em', dy: '0.7em', 'text-anchor': 'end'},
18661
18661
  c: {dx: 0, dy: '0.25em', 'text-anchor': 'middle'}
18662
18662
  };
18663
18663
 
@@ -31667,6 +31667,10 @@ ${svg}
31667
31667
  type: 'flag'
31668
31668
  })
31669
31669
  .option('where', whereOpt)
31670
+ .option('ids', {
31671
+ describe: 'comma-sep. list of feature ids to style',
31672
+ type: 'numbers'
31673
+ })
31670
31674
  .option('class', {
31671
31675
  describe: 'name of CSS class or classes (space-separated)'
31672
31676
  })
@@ -44077,7 +44081,17 @@ ${svg}
44077
44081
  return utils.pickOne(schemes) || 'Tableau20';
44078
44082
  }
44079
44083
 
44080
- function getCategoricalColorScheme(name, n) {
44084
+ function randomRotateArr(arr) {
44085
+ var n = Math.floor(Math.random() * arr.length);
44086
+ return arr.slice(-n).concat(arr.slice(0, -n));
44087
+ }
44088
+
44089
+ function getRandomizedCategoricalColorScheme(n) {
44090
+ var name = pickRandomCategoricalScheme(n);
44091
+ return getCategoricalColorScheme(name, n, true);
44092
+ }
44093
+
44094
+ function getCategoricalColorScheme(name, n, randomized) {
44081
44095
  var colors;
44082
44096
  initSchemes();
44083
44097
  name = standardName(name);
@@ -44092,7 +44106,11 @@ ${svg}
44092
44106
  // stop(name, 'does not contain', n, 'colors');
44093
44107
  message('Color scheme has', colors.length, 'colors. Using duplication to match', n, 'categories.');
44094
44108
  colors = wrapColors(colors, n);
44095
- } else {
44109
+ }
44110
+ if (randomized) {
44111
+ colors = randomRotateArr(colors);
44112
+ }
44113
+ if (n < colors.length) {
44096
44114
  colors = colors.slice(0, n);
44097
44115
  }
44098
44116
  return colors;
@@ -44183,7 +44201,7 @@ ${svg}
44183
44201
 
44184
44202
  if (colorArg == 'random') {
44185
44203
  if (categorical) {
44186
- colorScheme = pickRandomCategoricalScheme(n);
44204
+ return getRandomizedCategoricalColorScheme(n);
44187
44205
  } else {
44188
44206
  colorScheme = pickRandomColorScheme('sequential');
44189
44207
  }
@@ -56697,6 +56715,9 @@ ${svg}
56697
56715
  if (opts.where) {
56698
56716
  filterFn = compileFeatureExpression(opts.where, lyr, dataset.arcs);
56699
56717
  }
56718
+ if (opts.ids) {
56719
+ filterFn = combineFilters(filterFn, getIdFilter(opts.ids));
56720
+ }
56700
56721
  if (opts.clear) {
56701
56722
  lyr.data.getFields().filter(isSupportedSvgStyleProperty).forEach(lyr.data.deleteField, lyr.data);
56702
56723
  }
@@ -58248,7 +58269,7 @@ ${svg}
58248
58269
  });
58249
58270
  }
58250
58271
 
58251
- var version = "0.7.17";
58272
+ var version = "0.7.18";
58252
58273
 
58253
58274
  // Parse command line args into commands and run them
58254
58275
  // Function takes an optional Node-style callback. A Promise is returned if no callback is given.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mapshaper",
3
- "version": "0.7.17",
4
- "description": "A tool for editing vector datasets for mapping and GIS.",
3
+ "version": "0.7.18",
4
+ "description": "A tool for editing geospatial data for mapping and GIS.",
5
5
  "keywords": [
6
6
  "shapefile",
7
7
  "topojson",
package/www/index.html CHANGED
@@ -48,7 +48,7 @@
48
48
  </svg>
49
49
 
50
50
  <svg id="text-tool-icon" xmlns="http://www.w3.org/2000/svg" width="15" height="22" viewBox="0 0 15 22">
51
- <path d="M13.4125,6.1758c-.0735,0-.1704.0087-.3023.0225-.35.0418-1.1581.0841-1.6018.0841H3.4416c-.4199,0-1.2035-.0418-1.5848-.0845-.1272-.0133-.2242-.022-.2977-.022-.5733,0-.5733.5104-.5733.678v3.8421h.9614c.8167,0,1.1245-.4428,1.2361-.7083.43-1.0372.9151-1.2196,1.775-1.2196h.6348v8.7486c0,.3918-.0528.4281-.463.7111l-.0919.0634c-.4874.3427-.6362.5765-.6362,1.0014v1.1346h6.1463v-1.1346c0-.4222-.1617-.6753-.6992-1.0441-.435-.3023-.4708-.3266-.4708-.7318v-8.7486h.6353c.8439,0,1.3253.1833,1.7754,1.2205.1851.4428.6307.7074,1.1925.7074h1.0042v-3.8421c0-.1677,0-.678-.5733-.678Z"/>
51
+ <path d="M13.4125,6.1758c-.0735,0-.1704.0087-.3023.0225-.35.0418-1.1581.0841-1.6018.0841H3.4416c-.4199,0-1.2035-.0418-1.5848-.0845-.1272-.0133-.2242-.022-.2977-.022-.5733,0-.5733.5104-.5733.678v3.8421h.9614c.8167,0,1.1245-.4428,1.2361-.7083.43-1.0372.9151-1.2196,1.775-1.2196h.6348v9.7486c0,.3918-.0528.4281-.463.7111l-.0919.0634c-.4874.3427-.6362.5765-.6362,1.0014v1.1346h6.1463v-1.1346c0-.4222-.1617-.6753-.6992-1.0441-.435-.3023-.4708-.3266-.4708-.7318v-9.7486h.6353c.8439,0,1.3253.1833,1.7754,1.2205.1851.4428.6307.7074,1.1925.7074h1.0042v-3.8421c0-.1677,0-.678-.5733-.678Z"/>
52
52
  </svg>
53
53
 
54
54
  <!-- adjusted height -->