mapshaper 0.5.108 → 0.5.111
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 +13 -0
- package/mapshaper.js +479 -381
- package/package.json +4 -2
- package/www/index.html +3 -0
- package/www/mapshaper-gui.js +95 -62
- package/www/mapshaper.js +479 -381
- package/www/modules.js +5 -1
- package/www/page.css +26 -18
package/www/modules.js
CHANGED
|
@@ -5343,7 +5343,11 @@ function handleQs(url, query) {
|
|
|
5343
5343
|
}
|
|
5344
5344
|
exports["default"] = handleQs;
|
|
5345
5345
|
|
|
5346
|
-
},{"qs":25}],"
|
|
5346
|
+
},{"qs":25}],"@tmcw/togeojson":[function(require,module,exports){
|
|
5347
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).toGeoJSON={})}(this,(function(e){"use strict";function t(e){return e&&e.normalize&&e.normalize(),e&&e.textContent||""}function n(e,t){const n=e.getElementsByTagName(t);return n.length?n[0]:null}function o(e){const o={};if(e){const s=n(e,"line");if(s){const e=t(n(s,"color")),r=parseFloat(t(n(s,"opacity"))),i=parseFloat(t(n(s,"width")));e&&(o.stroke=e),isNaN(r)||(o["stroke-opacity"]=r),isNaN(i)||(o["stroke-width"]=96*i/25.4)}}return o}function s(e){let n=[];if(null!==e)for(let o=0;o<e.childNodes.length;o++){const r=e.childNodes[o];if(1!==r.nodeType)continue;const i=["heart","gpxtpx:hr","hr"].includes(r.nodeName)?"heart":r.nodeName;if("gpxtpx:TrackPointExtension"===i)n=n.concat(s(r));else{const e=t(r);n.push([i,isNaN(e)?e:parseFloat(e)])}}return n}function r(e,o){const s={};let r,i;for(i=0;i<o.length;i++)r=n(e,o[i]),r&&(s[o[i]]=t(r));return s}function i(e){const n=r(e,["name","cmt","desc","type","time","keywords"]),o=e.getElementsByTagNameNS("http://www.garmin.com/xmlschemas/GpxExtensions/v3","*");for(let s=0;s<o.length;s++){const r=o[s];r.parentNode.parentNode===e&&(n[r.tagName.replace(":","_")]=t(r))}const s=e.getElementsByTagName("link");s.length&&(n.links=[]);for(let e=0;e<s.length;e++)n.links.push(Object.assign({href:s[e].getAttribute("href")},r(s[e],["text","type"])));return n}function l(e){const o=[parseFloat(e.getAttribute("lon")),parseFloat(e.getAttribute("lat"))],r=n(e,"ele"),i=n(e,"time");if(r){const e=parseFloat(t(r));isNaN(e)||o.push(e)}return{coordinates:o,time:i?t(i):null,extendedValues:s(n(e,"extensions"))}}function a(e){const t=c(e,"rtept");if(t)return{type:"Feature",properties:Object.assign(i(e),o(n(e,"extensions")),{_gpxType:"rte"}),geometry:{type:"LineString",coordinates:t.line}}}function c(e,t){const n=e.getElementsByTagName(t);if(n.length<2)return;const o=[],s=[],r={};for(let e=0;e<n.length;e++){const t=l(n[e]);o.push(t.coordinates),t.time&&s.push(t.time);for(let o=0;o<t.extendedValues.length;o++){const[s,i]=t.extendedValues[o],l="heart"===s?s:s.replace("gpxtpx:","")+"s";r[l]||(r[l]=Array(n.length).fill(null)),r[l][e]=i}}return{line:o,times:s,extendedValues:r}}function g(e){const t=e.getElementsByTagName("trkseg"),s=[],r=[],l=[];for(let e=0;e<t.length;e++){const n=c(t[e],"trkpt");n&&(l.push(n),n.times&&n.times.length&&r.push(n.times))}if(0===l.length)return;const a=l.length>1,g=Object.assign(i(e),o(n(e,"extensions")),{_gpxType:"trk"},r.length?{coordinateProperties:{times:a?r:r[0]}}:{});for(let e=0;e<l.length;e++){const t=l[e];s.push(t.line);for(const[n,o]of Object.entries(t.extendedValues)){g.coordinateProperties||(g.coordinateProperties={});const t=g.coordinateProperties;a?(t[n]||(t[n]=l.map((e=>new Array(e.line.length).fill(null)))),t[n][e]=o):t[n]=o}}return{type:"Feature",properties:g,geometry:a?{type:"MultiLineString",coordinates:s}:{type:"LineString",coordinates:s[0]}}}function*u(e){const t=e.getElementsByTagName("trk"),n=e.getElementsByTagName("rte"),o=e.getElementsByTagName("wpt");for(let e=0;e<t.length;e++){const n=g(t[e]);n&&(yield n)}for(let e=0;e<n.length;e++){const t=a(n[e]);t&&(yield t)}for(let e=0;e<o.length;e++)yield(s=o[e],{type:"Feature",properties:Object.assign(i(s),r(s,["sym"])),geometry:{type:"Point",coordinates:l(s).coordinates}});var s}const p=[["heartRate","heartRates"],["Cadence","cadences"],["Speed","speeds"],["Watts","watts"]],m=[["TotalTimeSeconds","totalTimeSeconds"],["DistanceMeters","distanceMeters"],["MaximumSpeed","maxSpeed"],["AverageHeartRateBpm","avgHeartRate"],["MaximumHeartRateBpm","maxHeartRate"],["AvgSpeed","avgSpeed"],["AvgWatts","avgWatts"],["MaxWatts","maxWatts"]];function d(e,o){const s=[];for(const[r,i]of o){let o=n(e,r);if(!o){const t=e.getElementsByTagNameNS("http://www.garmin.com/xmlschemas/ActivityExtension/v2",r);t.length&&(o=t[0])}const l=parseFloat(t(o));isNaN(l)||s.push([i,l])}return s}function f(e){const o=t(n(e,"LongitudeDegrees")),s=t(n(e,"LatitudeDegrees"));if(!o.length||!s.length)return null;const r=[parseFloat(o),parseFloat(s)],i=n(e,"AltitudeMeters"),l=n(e,"HeartRateBpm"),a=n(e,"Time");let c;return i&&(c=parseFloat(t(i)),isNaN(c)||r.push(c)),{coordinates:r,time:a?t(a):null,heartRate:l?parseFloat(t(l)):null,extensions:d(e,p)}}function h(e,t){const n=e.getElementsByTagName(t),o=[],s=[],r=[];if(n.length<2)return null;const i={extendedProperties:{}};for(let e=0;e<n.length;e++){const t=f(n[e]);if(null!==t){o.push(t.coordinates),t.time&&s.push(t.time),t.heartRate&&r.push(t.heartRate);for(const[o,s]of t.extensions)i.extendedProperties[o]||(i.extendedProperties[o]=Array(n.length).fill(null)),i.extendedProperties[o][e]=s}}return Object.assign(i,{line:o,times:s,heartRates:r})}function y(e){const o=e.getElementsByTagName("Track"),s=[],r=[],i=[],l=[];let a;const c=function(e){const t={};for(const[n,o]of e)t[n]=o;return t}(d(e,m)),g=n(e,"Name");g&&(c.name=t(g));for(let e=0;e<o.length;e++)a=h(o[e],"Trackpoint"),a&&(s.push(a.line),a.times.length&&r.push(a.times),a.heartRates.length&&i.push(a.heartRates),l.push(a.extendedProperties));for(let e=0;e<l.length;e++){const t=l[e];for(const n in t)1===o.length?c[n]=a.extendedProperties[n]:(c[n]||(c[n]=s.map((e=>Array(e.length).fill(null)))),c[n][e]=t[n])}if(0!==s.length)return(r.length||i.length)&&(c.coordinateProperties=Object.assign(r.length?{times:1===s.length?r[0]:r}:{},i.length?{heart:1===s.length?i[0]:i}:{})),{type:"Feature",properties:c,geometry:{type:1===s.length?"LineString":"MultiLineString",coordinates:1===s.length?s[0]:s}}}function*N(e){const t=e.getElementsByTagName("Lap");for(let e=0;e<t.length;e++){const n=y(t[e]);n&&(yield n)}const n=e.getElementsByTagName("Courses");for(let e=0;e<n.length;e++){const t=y(n[e]);t&&(yield t)}}const x=/\s*/g,T=/^\s*|\s*$/g,b=/\s+/;function S(e){if(!e||!e.length)return 0;let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return t}function k(e){return e.replace(x,"").split(",").map(parseFloat)}function E(e){return e.replace(T,"").split(b).map(k)}function A(e){if(void 0!==e.xml)return e.xml;if(e.tagName){let t=e.tagName;for(let n=0;n<e.attributes.length;n++)t+=e.attributes[n].name+e.attributes[n].value;for(let n=0;n<e.childNodes.length;n++)t+=A(e.childNodes[n]);return t}return"#text"===e.nodeName?(e.nodeValue||e.value||"").trim():"#cdata-section"===e.nodeName?e.nodeValue:""}const B=["Polygon","LineString","Point","Track","gx:Track"];function P(e,o,s){let r=t(n(o,"color"))||"";const i="stroke"==s||"fill"===s?s:s+"-color";"#"===r.substr(0,1)&&(r=r.substr(1)),6===r.length||3===r.length?e[i]=r:8===r.length&&(e[s+"-opacity"]=parseInt(r.substr(0,2),16)/255,e[i]="#"+r.substr(6,2)+r.substr(4,2)+r.substr(2,2))}function F(e,o,s,r){const i=parseFloat(t(n(o,s)));isNaN(i)||(e[r]=i)}function v(e){let n=e.getElementsByTagName("coord");const o=[],s=[];0===n.length&&(n=e.getElementsByTagName("gx:coord"));for(let e=0;e<n.length;e++)o.push(t(n[e]).split(" ").map(parseFloat));const r=e.getElementsByTagName("when");for(let e=0;e<r.length;e++)s.push(t(r[e]));return{coords:o,times:s}}function L(e){let o,s,r,i,l;const a=[],c=[];if(n(e,"MultiGeometry"))return L(n(e,"MultiGeometry"));if(n(e,"MultiTrack"))return L(n(e,"MultiTrack"));if(n(e,"gx:MultiTrack"))return L(n(e,"gx:MultiTrack"));for(r=0;r<B.length;r++)if(s=e.getElementsByTagName(B[r]),s)for(i=0;i<s.length;i++)if(o=s[i],"Point"===B[r])a.push({type:"Point",coordinates:k(t(n(o,"coordinates")))});else if("LineString"===B[r])a.push({type:"LineString",coordinates:E(t(n(o,"coordinates")))});else if("Polygon"===B[r]){const e=o.getElementsByTagName("LinearRing"),s=[];for(l=0;l<e.length;l++)s.push(E(t(n(e[l],"coordinates"))));a.push({type:"Polygon",coordinates:s})}else if("Track"===B[r]||"gx:Track"===B[r]){const e=v(o);a.push({type:"LineString",coordinates:e.coords}),e.times.length&&c.push(e.times)}return{geoms:a,coordTimes:c}}function M(e,o,s,r){const i=L(e);let l;const a={},c=t(n(e,"name")),g=t(n(e,"address"));let u=t(n(e,"styleUrl"));const p=t(n(e,"description")),m=n(e,"TimeSpan"),d=n(e,"TimeStamp"),f=n(e,"ExtendedData");let h=n(e,"IconStyle"),y=n(e,"LabelStyle"),N=n(e,"LineStyle"),x=n(e,"PolyStyle");const T=n(e,"visibility");if(c&&(a.name=c),g&&(a.address=g),u){"#"!==u[0]&&(u="#"+u),a.styleUrl=u,o[u]&&(a.styleHash=o[u]),s[u]&&(a.styleMapHash=s[u],a.styleHash=o[s[u].normal]);const e=r[a.styleHash];e&&(h||(h=n(e,"IconStyle")),y||(y=n(e,"LabelStyle")),N||(N=n(e,"LineStyle")),x||(x=n(e,"PolyStyle")))}if(p&&(a.description=p),m){const e=t(n(m,"begin")),o=t(n(m,"end"));a.timespan={begin:e,end:o}}if(d&&(a.timestamp=t(n(d,"when"))),h){P(a,h,"icon"),F(a,h,"scale","icon-scale"),F(a,h,"heading","icon-heading");const e=n(h,"hotSpot");if(e){const t=parseFloat(e.getAttribute("x")),n=parseFloat(e.getAttribute("y"));isNaN(t)||isNaN(n)||(a["icon-offset"]=[t,n])}const o=n(h,"Icon");if(o){const e=t(n(o,"href"));e&&(a.icon=e)}}if(y&&(P(a,y,"label"),F(a,y,"scale","label-scale")),N&&(P(a,N,"stroke"),F(a,N,"width","stroke-width")),x){P(a,x,"fill");const e=t(n(x,"fill")),o=t(n(x,"outline"));e&&(a["fill-opacity"]="1"===e?a["fill-opacity"]||1:0),o&&(a["stroke-opacity"]="1"===o?a["stroke-opacity"]||1:0)}if(f){const e=f.getElementsByTagName("Data"),o=f.getElementsByTagName("SimpleData");for(l=0;l<e.length;l++)a[e[l].getAttribute("name")]=t(n(e[l],"value"));for(l=0;l<o.length;l++)a[o[l].getAttribute("name")]=t(o[l])}T&&(a.visibility=t(T)),i.coordTimes.length&&(a.coordinateProperties={times:1===i.coordTimes.length?i.coordTimes[0]:i.coordTimes});const b={type:"Feature",geometry:0===i.geoms.length?null:1===i.geoms.length?i.geoms[0]:{type:"GeometryCollection",geometries:i.geoms},properties:a};return e.getAttribute("id")&&(b.id=e.getAttribute("id")),b}function*w(e){const o={},s={},r={},i=e.getElementsByTagName("Placemark"),l=e.getElementsByTagName("Style"),a=e.getElementsByTagName("StyleMap");for(let e=0;e<l.length;e++){const t=l[e],n=S(A(t)).toString(16);let r=t.getAttribute("id");r||"CascadingStyle"!==t.parentNode.tagName.replace("gx:","")||(r=t.parentNode.getAttribute("kml:id")||t.parentNode.getAttribute("id")),o["#"+r]=n,s[n]=t}for(let e=0;e<a.length;e++){o["#"+a[e].getAttribute("id")]=S(A(a[e])).toString(16);const s=a[e].getElementsByTagName("Pair"),i={};for(let e=0;e<s.length;e++)i[t(n(s[e],"key"))]=t(n(s[e],"styleUrl"));r["#"+a[e].getAttribute("id")]=i}for(let e=0;e<i.length;e++){const t=M(i[e],o,r,s);t&&(yield t)}}e.gpx=function(e){return{type:"FeatureCollection",features:Array.from(u(e))}},e.gpxGen=u,e.kml=function(e){return{type:"FeatureCollection",features:Array.from(w(e))}},e.kmlGen=w,e.tcx=function(e){return{type:"FeatureCollection",features:Array.from(N(e))}},e.tcxGen=N,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
5348
|
+
|
|
5349
|
+
|
|
5350
|
+
},{}],"buffer":[function(require,module,exports){
|
|
5347
5351
|
(function (Buffer){(function (){
|
|
5348
5352
|
/*!
|
|
5349
5353
|
* The buffer module from node.js, for the browser.
|
package/www/page.css
CHANGED
|
@@ -76,13 +76,17 @@ body {
|
|
|
76
76
|
fill: #1385B7;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
.dialog-btn:hover,
|
|
79
|
+
.dialog-btn:hover:not(.disabled),
|
|
80
80
|
.btn.header-btn:hover,
|
|
81
81
|
.dialog-btn.default-btn,
|
|
82
82
|
.dialog-btn.selected-btn {
|
|
83
83
|
background-color: #1A6A96;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
+
.dialog-btn.disabled {
|
|
87
|
+
opacity: 0.5;
|
|
88
|
+
}
|
|
89
|
+
|
|
86
90
|
.colored-text::selection {
|
|
87
91
|
background-color: #e6f7ff;
|
|
88
92
|
}
|
|
@@ -451,7 +455,7 @@ body.dragover #import-options-drop-area .drop-area {
|
|
|
451
455
|
|
|
452
456
|
.info-box,.popup {
|
|
453
457
|
border-radius: 9px;
|
|
454
|
-
border: 1px solid #ddd;
|
|
458
|
+
/* border: 1px solid #ddd; */
|
|
455
459
|
box-shadow: 0 4px 6px rgba(0,0,0,0.35);
|
|
456
460
|
background-color: #fff;
|
|
457
461
|
}
|
|
@@ -1042,20 +1046,22 @@ img.close-btn:hover,
|
|
|
1042
1046
|
|
|
1043
1047
|
.basemap-style-btn img {
|
|
1044
1048
|
display: block;
|
|
1045
|
-
left: -
|
|
1049
|
+
left: -2px;
|
|
1046
1050
|
position: relative;
|
|
1047
|
-
border:
|
|
1048
|
-
width: 120px;
|
|
1049
|
-
height: 90px
|
|
1051
|
+
border: 2px solid transparent;
|
|
1052
|
+
/*width: 120px;
|
|
1053
|
+
height: 90px;*/
|
|
1054
|
+
width: 96px;
|
|
1055
|
+
height: 72px;
|
|
1050
1056
|
}
|
|
1051
1057
|
|
|
1052
1058
|
div.basemap-style-btn.active img {
|
|
1053
|
-
border:
|
|
1059
|
+
border: 2px solid #e8ba52;
|
|
1054
1060
|
}
|
|
1055
1061
|
|
|
1056
1062
|
.basemap-style-btn:hover img {
|
|
1057
1063
|
cursor: pointer;
|
|
1058
|
-
border:
|
|
1064
|
+
border: 2px solid #ead683;
|
|
1059
1065
|
}
|
|
1060
1066
|
|
|
1061
1067
|
.mapbox-improve-map {
|
|
@@ -1104,10 +1110,11 @@ div.basemap-style-btn.active img {
|
|
|
1104
1110
|
.nav-buttons {
|
|
1105
1111
|
z-index: 20;
|
|
1106
1112
|
position: absolute;
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1113
|
+
text-align: center;
|
|
1114
|
+
top: 12px;
|
|
1115
|
+
right: 0;
|
|
1116
|
+
padding: 3px;
|
|
1117
|
+
background-color: rgba(255, 255, 255, 1);
|
|
1111
1118
|
}
|
|
1112
1119
|
|
|
1113
1120
|
.nav-btn-wrapper {
|
|
@@ -1136,8 +1143,8 @@ div.basemap-style-btn.active img {
|
|
|
1136
1143
|
display: none;
|
|
1137
1144
|
pointer-events: none;
|
|
1138
1145
|
padding-top: 4px;
|
|
1139
|
-
top:
|
|
1140
|
-
right: -
|
|
1146
|
+
top: 26px;
|
|
1147
|
+
right: -3px;
|
|
1141
1148
|
}
|
|
1142
1149
|
|
|
1143
1150
|
.nav-btn.open .nav-sub-menu {
|
|
@@ -1152,7 +1159,7 @@ div.basemap-style-btn.active img {
|
|
|
1152
1159
|
clear: right;
|
|
1153
1160
|
white-space: nowrap;
|
|
1154
1161
|
display: inline-block;
|
|
1155
|
-
padding:
|
|
1162
|
+
padding: 4px 7px 5px 7px;
|
|
1156
1163
|
line-height: 11px;
|
|
1157
1164
|
cursor: pointer;
|
|
1158
1165
|
}
|
|
@@ -1175,17 +1182,18 @@ div.basemap-style-btn.active img {
|
|
|
1175
1182
|
.nav-btn {
|
|
1176
1183
|
position: relative;
|
|
1177
1184
|
cursor:pointer;
|
|
1178
|
-
padding: 3px 3px 5px 3px;
|
|
1185
|
+
/* padding: 3px 3px 5px 3px; */
|
|
1186
|
+
padding: 4px;
|
|
1179
1187
|
line-height: 1;
|
|
1180
1188
|
}
|
|
1181
1189
|
|
|
1182
1190
|
.nav-btn.menu-btn {
|
|
1183
|
-
padding:
|
|
1191
|
+
padding-top: 3px;
|
|
1184
1192
|
}
|
|
1185
1193
|
|
|
1186
1194
|
.nav-btn.selected {
|
|
1187
1195
|
background-color: black;
|
|
1188
|
-
border-radius: 3px;
|
|
1196
|
+
/* border-radius: 3px; */
|
|
1189
1197
|
}
|
|
1190
1198
|
|
|
1191
1199
|
.nav-btn:hover:not(.disabled) svg *,
|