qwc2 2025.10.29 → 2025.10.30
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.
|
@@ -483,7 +483,7 @@ var ImportLayer = /*#__PURE__*/function (_React$Component) {
|
|
|
483
483
|
});
|
|
484
484
|
_defineProperty(_this, "addSHPLayer", /*#__PURE__*/function () {
|
|
485
485
|
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(file) {
|
|
486
|
-
var _yield$import3, _BrowserFileSystem, load, _yield$import4,
|
|
486
|
+
var _yield$import3, _BrowserFileSystem, load, _yield$import4, Proj4Projection, _yield$import5, ShapefileLoader, _yield$import6, ZipLoader, mimeTypes, projections, fileMap, EXTENSIONS, files, fileName, name, ext, fileList, blob, f, list, fileSystem, fetch, filename, data;
|
|
487
487
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
488
488
|
while (1) switch (_context2.prev = _context2.next) {
|
|
489
489
|
case 0:
|
|
@@ -494,22 +494,33 @@ var ImportLayer = /*#__PURE__*/function (_React$Component) {
|
|
|
494
494
|
_BrowserFileSystem = _yield$import3._BrowserFileSystem;
|
|
495
495
|
load = _yield$import3.load;
|
|
496
496
|
_context2.next = 7;
|
|
497
|
-
return import('@
|
|
497
|
+
return import('@math.gl/proj4');
|
|
498
498
|
case 7:
|
|
499
499
|
_yield$import4 = _context2.sent;
|
|
500
|
-
|
|
500
|
+
Proj4Projection = _yield$import4.Proj4Projection;
|
|
501
501
|
_context2.next = 11;
|
|
502
|
-
return import('@loaders.gl/
|
|
502
|
+
return import('@loaders.gl/shapefile');
|
|
503
503
|
case 11:
|
|
504
504
|
_yield$import5 = _context2.sent;
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
505
|
+
ShapefileLoader = _yield$import5.ShapefileLoader;
|
|
506
|
+
_context2.next = 15;
|
|
507
|
+
return import('@loaders.gl/zip');
|
|
508
|
+
case 15:
|
|
509
|
+
_yield$import6 = _context2.sent;
|
|
510
|
+
ZipLoader = _yield$import6.ZipLoader;
|
|
511
|
+
// Import SHP layer from ZIP. Zip must contain all the required files : shp, dbf, shx, prj, cpg
|
|
512
|
+
mimeTypes = ['application/zip', 'application/zip-compressed', 'application/x-zip-compressed'];
|
|
513
|
+
if (!mimeTypes.includes(file.type)) {
|
|
514
|
+
_context2.next = 58;
|
|
508
515
|
break;
|
|
509
516
|
}
|
|
510
|
-
|
|
517
|
+
projections = ConfigUtils.getConfigProp("projections") || [];
|
|
518
|
+
if (projections) {
|
|
519
|
+
Proj4Projection.defineProjectionAliases(projections);
|
|
520
|
+
}
|
|
521
|
+
_context2.next = 23;
|
|
511
522
|
return load(file, ZipLoader);
|
|
512
|
-
case
|
|
523
|
+
case 23:
|
|
513
524
|
fileMap = _context2.sent;
|
|
514
525
|
EXTENSIONS = ['shp', 'shx', 'dbf', 'cpg', 'prj'];
|
|
515
526
|
files = {}; // Iterate through all the files in ZIP to get a list of (SHP + sidecar files) by filename
|
|
@@ -528,14 +539,14 @@ var ImportLayer = /*#__PURE__*/function (_React$Component) {
|
|
|
528
539
|
}
|
|
529
540
|
// Load each SHP with sidecar files as GeoJSON features
|
|
530
541
|
_context2.t0 = _regeneratorRuntime().keys(files);
|
|
531
|
-
case
|
|
542
|
+
case 28:
|
|
532
543
|
if ((_context2.t1 = _context2.t0()).done) {
|
|
533
|
-
_context2.next =
|
|
544
|
+
_context2.next = 57;
|
|
534
545
|
break;
|
|
535
546
|
}
|
|
536
547
|
f = _context2.t1.value;
|
|
537
548
|
if (!Object.hasOwn(files, f)) {
|
|
538
|
-
_context2.next =
|
|
549
|
+
_context2.next = 55;
|
|
539
550
|
break;
|
|
540
551
|
}
|
|
541
552
|
list = files[f];
|
|
@@ -543,8 +554,8 @@ var ImportLayer = /*#__PURE__*/function (_React$Component) {
|
|
|
543
554
|
fetch = fileSystem.fetch.bind(fileSystem.fetch);
|
|
544
555
|
filename = "".concat(f, ".shp"); // Load SHP and reproject to mapCrs
|
|
545
556
|
data = null;
|
|
546
|
-
_context2.prev =
|
|
547
|
-
_context2.next =
|
|
557
|
+
_context2.prev = 36;
|
|
558
|
+
_context2.next = 39;
|
|
548
559
|
return load(filename, ShapefileLoader, {
|
|
549
560
|
fetch: fetch,
|
|
550
561
|
shapefile: {
|
|
@@ -556,15 +567,15 @@ var ImportLayer = /*#__PURE__*/function (_React$Component) {
|
|
|
556
567
|
_targetCrs: _this.props.mapCrs
|
|
557
568
|
}
|
|
558
569
|
});
|
|
559
|
-
case
|
|
570
|
+
case 39:
|
|
560
571
|
data = _context2.sent;
|
|
561
|
-
_context2.next =
|
|
572
|
+
_context2.next = 54;
|
|
562
573
|
break;
|
|
563
|
-
case
|
|
564
|
-
_context2.prev =
|
|
565
|
-
_context2.t2 = _context2["catch"](
|
|
566
|
-
_context2.prev =
|
|
567
|
-
_context2.next =
|
|
574
|
+
case 42:
|
|
575
|
+
_context2.prev = 42;
|
|
576
|
+
_context2.t2 = _context2["catch"](36);
|
|
577
|
+
_context2.prev = 44;
|
|
578
|
+
_context2.next = 47;
|
|
568
579
|
return load(filename, ShapefileLoader, {
|
|
569
580
|
fetch: fetch,
|
|
570
581
|
shapefile: {
|
|
@@ -576,17 +587,17 @@ var ImportLayer = /*#__PURE__*/function (_React$Component) {
|
|
|
576
587
|
_targetCrs: _this.props.mapCrs
|
|
577
588
|
}
|
|
578
589
|
});
|
|
579
|
-
case
|
|
590
|
+
case 47:
|
|
580
591
|
data = _context2.sent;
|
|
581
592
|
/* eslint-disable-next-line */
|
|
582
593
|
alert(LocaleUtils.tr("importlayer.shpreprojectionerror"));
|
|
583
|
-
_context2.next =
|
|
594
|
+
_context2.next = 54;
|
|
584
595
|
break;
|
|
585
|
-
case
|
|
586
|
-
_context2.prev =
|
|
587
|
-
_context2.t3 = _context2["catch"](
|
|
596
|
+
case 51:
|
|
597
|
+
_context2.prev = 51;
|
|
598
|
+
_context2.t3 = _context2["catch"](44);
|
|
588
599
|
data = null;
|
|
589
|
-
case
|
|
600
|
+
case 54:
|
|
590
601
|
if (data) {
|
|
591
602
|
data.crs = {
|
|
592
603
|
type: "name",
|
|
@@ -597,19 +608,19 @@ var ImportLayer = /*#__PURE__*/function (_React$Component) {
|
|
|
597
608
|
// Add data as GeoJSON layer
|
|
598
609
|
_this.addGeoJSONLayer(f, data);
|
|
599
610
|
}
|
|
600
|
-
case
|
|
601
|
-
_context2.next =
|
|
611
|
+
case 55:
|
|
612
|
+
_context2.next = 28;
|
|
602
613
|
break;
|
|
603
|
-
case
|
|
614
|
+
case 57:
|
|
604
615
|
_this.setState({
|
|
605
616
|
file: null,
|
|
606
617
|
addingLayer: false
|
|
607
618
|
});
|
|
608
|
-
case
|
|
619
|
+
case 58:
|
|
609
620
|
case "end":
|
|
610
621
|
return _context2.stop();
|
|
611
622
|
}
|
|
612
|
-
}, _callee2, null, [[
|
|
623
|
+
}, _callee2, null, [[36, 42], [44, 51]]);
|
|
613
624
|
}));
|
|
614
625
|
return function (_x2) {
|
|
615
626
|
return _ref6.apply(this, arguments);
|
package/package.json
CHANGED
|
@@ -196,7 +196,7 @@ var RedliningSupport = /*#__PURE__*/function (_React$Component) {
|
|
|
196
196
|
areaUnit: _this.props.redlining.areaUnit
|
|
197
197
|
};
|
|
198
198
|
MeasureUtils.updateFeatureMeasurements(feature, feature.get('shape'), _this.props.mapCrs, settings);
|
|
199
|
-
} else {
|
|
199
|
+
} else if (feature.get('measurements')) {
|
|
200
200
|
feature.set('measurements', undefined);
|
|
201
201
|
feature.set('segment_labels', undefined);
|
|
202
202
|
feature.set('label', '');
|