@corpsmap/corpsmap 3.1.0 → 3.1.1
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/lib/dev.js +26 -3
- package/lib/prod.js +26 -3
- package/package.json +1 -1
- package/src/core-plugins/identify-vector/bundle.js +60 -55
- package/src/openlayers-utils/format-utilities.js +20 -1
package/lib/dev.js
CHANGED
|
@@ -106484,7 +106484,7 @@ var config = {
|
|
|
106484
106484
|
};
|
|
106485
106485
|
|
|
106486
106486
|
var name = "@corpsmap/corpsmap";
|
|
106487
|
-
var version$1 = "3.1.
|
|
106487
|
+
var version$1 = "3.1.1";
|
|
106488
106488
|
var description = "CorpsMap as React Components";
|
|
106489
106489
|
var main = "index.js";
|
|
106490
106490
|
var scripts = {
|
|
@@ -132759,6 +132759,29 @@ var formatArcgisrest = function formatArcgisrest(attributes) {
|
|
|
132759
132759
|
return attributes;
|
|
132760
132760
|
};
|
|
132761
132761
|
|
|
132762
|
+
var formatArcgisVector = function formatArcgisVector(results) {
|
|
132763
|
+
results.map(function (feat) {
|
|
132764
|
+
for (var _i2 = 0, _Object$entries2 = Object.entries(feat.properties); _i2 < _Object$entries2.length; _i2++) {
|
|
132765
|
+
var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i2], 2),
|
|
132766
|
+
key = _Object$entries2$_i[0],
|
|
132767
|
+
value = _Object$entries2$_i[1];
|
|
132768
|
+
|
|
132769
|
+
var result = String(value).includes("https:") || String(value).includes("http:") ? value : null;
|
|
132770
|
+
|
|
132771
|
+
if (result) {
|
|
132772
|
+
feat.properties[key] = "<a href=\"".concat(value, "\" target=\"_new\" > ").concat(value, " </a>");
|
|
132773
|
+
}
|
|
132774
|
+
} // results.properties = feat.properties;
|
|
132775
|
+
|
|
132776
|
+
});
|
|
132777
|
+
return results;
|
|
132778
|
+
};
|
|
132779
|
+
|
|
132780
|
+
var formatUtilities = {
|
|
132781
|
+
formatArcgisVector: formatArcgisVector,
|
|
132782
|
+
formatArcgisrest: formatArcgisrest
|
|
132783
|
+
};
|
|
132784
|
+
|
|
132762
132785
|
function formatUrl(options) {
|
|
132763
132786
|
var url = "".concat(options.root, "/identify?");
|
|
132764
132787
|
var params = [];
|
|
@@ -132871,7 +132894,7 @@ var bundle$1 = {
|
|
|
132871
132894
|
type: featureType,
|
|
132872
132895
|
coordinates: coords
|
|
132873
132896
|
},
|
|
132874
|
-
properties:
|
|
132897
|
+
properties: formatUtilities(feat.attributes)
|
|
132875
132898
|
};
|
|
132876
132899
|
})
|
|
132877
132900
|
})
|
|
@@ -162018,7 +162041,7 @@ var bundle$d = {
|
|
|
162018
162041
|
err: null,
|
|
162019
162042
|
result: _defineProperty({}, lyr.uid, {
|
|
162020
162043
|
type: "FeatureCollection",
|
|
162021
|
-
features: outFeatures
|
|
162044
|
+
features: formatUtilities.formatArcgisVector(outFeatures)
|
|
162022
162045
|
})
|
|
162023
162046
|
});
|
|
162024
162047
|
}
|
package/lib/prod.js
CHANGED
|
@@ -106398,7 +106398,7 @@ var config = {
|
|
|
106398
106398
|
};
|
|
106399
106399
|
|
|
106400
106400
|
var name = "@corpsmap/corpsmap";
|
|
106401
|
-
var version$1 = "3.1.
|
|
106401
|
+
var version$1 = "3.1.1";
|
|
106402
106402
|
var description = "CorpsMap as React Components";
|
|
106403
106403
|
var main = "index.js";
|
|
106404
106404
|
var scripts = {
|
|
@@ -132673,6 +132673,29 @@ var formatArcgisrest = function formatArcgisrest(attributes) {
|
|
|
132673
132673
|
return attributes;
|
|
132674
132674
|
};
|
|
132675
132675
|
|
|
132676
|
+
var formatArcgisVector = function formatArcgisVector(results) {
|
|
132677
|
+
results.map(function (feat) {
|
|
132678
|
+
for (var _i2 = 0, _Object$entries2 = Object.entries(feat.properties); _i2 < _Object$entries2.length; _i2++) {
|
|
132679
|
+
var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i2], 2),
|
|
132680
|
+
key = _Object$entries2$_i[0],
|
|
132681
|
+
value = _Object$entries2$_i[1];
|
|
132682
|
+
|
|
132683
|
+
var result = String(value).includes("https:") || String(value).includes("http:") ? value : null;
|
|
132684
|
+
|
|
132685
|
+
if (result) {
|
|
132686
|
+
feat.properties[key] = "<a href=\"".concat(value, "\" target=\"_new\" > ").concat(value, " </a>");
|
|
132687
|
+
}
|
|
132688
|
+
} // results.properties = feat.properties;
|
|
132689
|
+
|
|
132690
|
+
});
|
|
132691
|
+
return results;
|
|
132692
|
+
};
|
|
132693
|
+
|
|
132694
|
+
var formatUtilities = {
|
|
132695
|
+
formatArcgisVector: formatArcgisVector,
|
|
132696
|
+
formatArcgisrest: formatArcgisrest
|
|
132697
|
+
};
|
|
132698
|
+
|
|
132676
132699
|
function formatUrl(options) {
|
|
132677
132700
|
var url = "".concat(options.root, "/identify?");
|
|
132678
132701
|
var params = [];
|
|
@@ -132785,7 +132808,7 @@ var bundle$1 = {
|
|
|
132785
132808
|
type: featureType,
|
|
132786
132809
|
coordinates: coords
|
|
132787
132810
|
},
|
|
132788
|
-
properties:
|
|
132811
|
+
properties: formatUtilities(feat.attributes)
|
|
132789
132812
|
};
|
|
132790
132813
|
})
|
|
132791
132814
|
})
|
|
@@ -161932,7 +161955,7 @@ var bundle$d = {
|
|
|
161932
161955
|
err: null,
|
|
161933
161956
|
result: _defineProperty({}, lyr.uid, {
|
|
161934
161957
|
type: "FeatureCollection",
|
|
161935
|
-
features: outFeatures
|
|
161958
|
+
features: formatUtilities.formatArcgisVector(outFeatures)
|
|
161936
161959
|
})
|
|
161937
161960
|
});
|
|
161938
161961
|
}
|
package/package.json
CHANGED
|
@@ -5,6 +5,7 @@ import disjoint from "@turf/boolean-disjoint";
|
|
|
5
5
|
import bbox from "@turf/bbox";
|
|
6
6
|
import GeoJSON from "ol/format/GeoJSON";
|
|
7
7
|
import { transformExtent } from "ol/proj";
|
|
8
|
+
import formatUtilities from "../../openlayers-utils/format-utilities";
|
|
8
9
|
|
|
9
10
|
const geoJSON = new GeoJSON();
|
|
10
11
|
|
|
@@ -26,67 +27,71 @@ export default {
|
|
|
26
27
|
};
|
|
27
28
|
},
|
|
28
29
|
|
|
29
|
-
doVectorIdentRegister:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
doVectorIdentRegister:
|
|
31
|
+
() =>
|
|
32
|
+
({ dispatch, store }) => {
|
|
33
|
+
dispatch({
|
|
34
|
+
type: "VECTOR_IDENT_REGISTERED",
|
|
35
|
+
payload: { shouldRegister: false },
|
|
36
|
+
});
|
|
37
|
+
store.doIdentifyAddCollection({
|
|
38
|
+
onIdentify: store.doVectorIdentFire,
|
|
39
|
+
});
|
|
40
|
+
},
|
|
38
41
|
|
|
39
|
-
doVectorIdentFire:
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
doVectorIdentFire:
|
|
43
|
+
(callback) =>
|
|
44
|
+
({ dispatch, store }) => {
|
|
45
|
+
const layers = store.selectVisibleLayers();
|
|
46
|
+
const coords = store.selectIdentifyCoordinates();
|
|
47
|
+
const resolution = store.selectResolution();
|
|
48
|
+
let identifyFeature = {};
|
|
49
|
+
const out = [];
|
|
45
50
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
if (typeof coords[0] === "number") {
|
|
52
|
+
const pt = point(coords);
|
|
53
|
+
const radius = (resolution * 5) / 1000;
|
|
54
|
+
identifyFeature = buffer(pt, radius, {
|
|
55
|
+
units: "kilometers",
|
|
56
|
+
});
|
|
57
|
+
} else {
|
|
58
|
+
identifyFeature = polygon(coords);
|
|
59
|
+
}
|
|
55
60
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
+
const identifyExtent = transformExtent(
|
|
62
|
+
bbox(identifyFeature),
|
|
63
|
+
"EPSG:4326",
|
|
64
|
+
"EPSG:3857"
|
|
65
|
+
);
|
|
61
66
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
layers.forEach((lyr) => {
|
|
68
|
+
if (lyr.identifyType === "arcgisvector") {
|
|
69
|
+
const { mapLayer } = lyr;
|
|
70
|
+
const outFeatures = [];
|
|
71
|
+
const src = mapLayer.getSource();
|
|
72
|
+
src.forEachFeatureIntersectingExtent(identifyExtent, (f) => {
|
|
73
|
+
const geoJsonFeature = geoJSON.writeFeatureObject(f, {
|
|
74
|
+
featureProjection: "EPSG:3857",
|
|
75
|
+
dataProjection: "EPSG:4326",
|
|
76
|
+
});
|
|
77
|
+
if (!disjoint(identifyFeature, geoJsonFeature))
|
|
78
|
+
outFeatures.push(geoJsonFeature);
|
|
71
79
|
});
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
type: "FeatureCollection",
|
|
82
|
-
features: outFeatures,
|
|
80
|
+
out.push({
|
|
81
|
+
dataset: lyr.uid,
|
|
82
|
+
layerName: lyr.displayName,
|
|
83
|
+
err: null,
|
|
84
|
+
result: {
|
|
85
|
+
[lyr.uid]: {
|
|
86
|
+
type: "FeatureCollection",
|
|
87
|
+
features: formatUtilities.formatArcgisVector(outFeatures),
|
|
88
|
+
},
|
|
83
89
|
},
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
},
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
return callback(null, out);
|
|
94
|
+
},
|
|
90
95
|
|
|
91
96
|
reactVectorIdentShouldRegister: (state) => {
|
|
92
97
|
if (state.vectorIdent.shouldRegister)
|
|
@@ -12,4 +12,23 @@ const formatArcgisrest = function (attributes) {
|
|
|
12
12
|
return attributes;
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
const formatArcgisVector = function (results) {
|
|
16
|
+
results.map((feat) => {
|
|
17
|
+
for (const [key, value] of Object.entries(feat.properties)) {
|
|
18
|
+
const result =
|
|
19
|
+
String(value).includes("https:") || String(value).includes("http:")
|
|
20
|
+
? value
|
|
21
|
+
: null;
|
|
22
|
+
|
|
23
|
+
if (result) {
|
|
24
|
+
feat.properties[
|
|
25
|
+
key
|
|
26
|
+
] = `<a href="${value}" target="_new" > ${value} </a>`;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
// results.properties = feat.properties;
|
|
30
|
+
});
|
|
31
|
+
return results;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export default { formatArcgisVector, formatArcgisrest };
|