mapshaper 0.5.114 → 0.5.115

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,3 +1,6 @@
1
+ v0.5.115
2
+ * Scalebar tweaks.
3
+
1
4
  v0.5.114
2
5
  * Bug fixes
3
6
 
package/mapshaper.js CHANGED
@@ -1,6 +1,6 @@
1
1
  (function () {
2
2
 
3
- var VERSION = "0.5.114";
3
+ var VERSION = "0.5.115";
4
4
 
5
5
 
6
6
  var utils = /*#__PURE__*/Object.freeze({
@@ -14942,6 +14942,11 @@
14942
14942
  var dx = pos.halign == 'right' ? frame.width - width - pos.hoffs : pos.hoffs;
14943
14943
  var dy = pos.valign == 'bottom' ? frame.height - height - pos.voffs : pos.voffs;
14944
14944
 
14945
+ if (!frame.crs) {
14946
+ message('Unable to render a scalebar: unknown CRS.');
14947
+ return [];
14948
+ }
14949
+
14945
14950
  if (labelPos == 'top') {
14946
14951
  anchorY = -labelOffs;
14947
14952
  dy += Math.round(labelOffs + fontSize * 0.8);
@@ -14982,10 +14987,11 @@
14982
14987
  }
14983
14988
 
14984
14989
  function getAutoScalebarLabel(mapWidth, metersPerPx) {
14985
- var minWidth = 75; // 100; // TODO: vary min size based on map width
14990
+ var minWidth = 70; // 100; // TODO: vary min size based on map width
14986
14991
  var minKm = metersPerPx * minWidth / 1000;
14987
- var options = ('1/8 1/5 1/4 1/2 1 1.5 2 3 4 5 8 10 12 15 20 25 30 40 50 75 ' +
14988
- '100 150 200 250 300 350 400 500 750 1,000 1,200 1,500 2,000 ' +
14992
+ // note: removed 1.5 12 and 1,200
14993
+ var options = ('1/8 1/5 1/4 1/2 1 2 3 4 5 8 10 15 20 25 30 40 50 75 ' +
14994
+ '100 150 200 250 300 350 400 500 750 1,000 1,500 2,000 ' +
14989
14995
  '2,500 3,000 4,000 5,000').split(' ');
14990
14996
  return options.reduce(function(memo, str) {
14991
14997
  if (memo) return memo;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mapshaper",
3
- "version": "0.5.114",
3
+ "version": "0.5.115",
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.114";
3
+ var VERSION = "0.5.115";
4
4
 
5
5
 
6
6
  var utils = /*#__PURE__*/Object.freeze({
@@ -14942,6 +14942,11 @@
14942
14942
  var dx = pos.halign == 'right' ? frame.width - width - pos.hoffs : pos.hoffs;
14943
14943
  var dy = pos.valign == 'bottom' ? frame.height - height - pos.voffs : pos.voffs;
14944
14944
 
14945
+ if (!frame.crs) {
14946
+ message('Unable to render a scalebar: unknown CRS.');
14947
+ return [];
14948
+ }
14949
+
14945
14950
  if (labelPos == 'top') {
14946
14951
  anchorY = -labelOffs;
14947
14952
  dy += Math.round(labelOffs + fontSize * 0.8);
@@ -14982,10 +14987,11 @@
14982
14987
  }
14983
14988
 
14984
14989
  function getAutoScalebarLabel(mapWidth, metersPerPx) {
14985
- var minWidth = 75; // 100; // TODO: vary min size based on map width
14990
+ var minWidth = 70; // 100; // TODO: vary min size based on map width
14986
14991
  var minKm = metersPerPx * minWidth / 1000;
14987
- var options = ('1/8 1/5 1/4 1/2 1 1.5 2 3 4 5 8 10 12 15 20 25 30 40 50 75 ' +
14988
- '100 150 200 250 300 350 400 500 750 1,000 1,200 1,500 2,000 ' +
14992
+ // note: removed 1.5 12 and 1,200
14993
+ var options = ('1/8 1/5 1/4 1/2 1 2 3 4 5 8 10 15 20 25 30 40 50 75 ' +
14994
+ '100 150 200 250 300 350 400 500 750 1,000 1,500 2,000 ' +
14989
14995
  '2,500 3,000 4,000 5,000').split(' ');
14990
14996
  return options.reduce(function(memo, str) {
14991
14997
  if (memo) return memo;