@corpsmap/corpsmap 3.1.0 → 3.1.3
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 +73 -22
- package/lib/prod.js +73 -22
- package/package.json +1 -1
- package/src/application-bundles/config-bundle.js +5 -1
- package/src/application-bundles/create-ol-map-bundle.js +25 -6
- package/src/application-bundles/map-view-bundle.js +312 -308
- package/src/application-containers/map.js +5 -3
- package/src/application-exports/map-provider.js +6 -1
- package/src/config/default-config.js +561 -561
- package/src/core-plugins/identify-vector/bundle.js +60 -55
- package/src/openlayers-utils/format-utilities.js +20 -1
- package/src/openlayers-utils/layer-utilities.js +7 -4
|
@@ -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 };
|
|
@@ -71,7 +71,8 @@ function getXyzSource(options) {
|
|
|
71
71
|
url: url,
|
|
72
72
|
crossOrigin: isCrossOrigin(options.url),
|
|
73
73
|
// CWBI-13636 Prevent horizontal wrapping.
|
|
74
|
-
|
|
74
|
+
// Line may no longer be needed.
|
|
75
|
+
// wrapX: false,
|
|
75
76
|
});
|
|
76
77
|
}
|
|
77
78
|
|
|
@@ -168,8 +169,9 @@ function getEsriVectorSource(options) {
|
|
|
168
169
|
}
|
|
169
170
|
|
|
170
171
|
function getTileLayer(options, source) {
|
|
171
|
-
// CWBI-13636 Prevent horizontal wrapping.
|
|
172
|
-
|
|
172
|
+
// CWBI-13636 Prevent horizontal wrapping.
|
|
173
|
+
// Line may no longer be needed.
|
|
174
|
+
// source.wrapX = false;
|
|
173
175
|
return new Tile({
|
|
174
176
|
source: source,
|
|
175
177
|
visible: options.visible,
|
|
@@ -182,7 +184,8 @@ function getTileLayer(options, source) {
|
|
|
182
184
|
|
|
183
185
|
function getImageLayer(options, source) {
|
|
184
186
|
// CWBI-13636 Prevent horizontal wrapping.
|
|
185
|
-
|
|
187
|
+
// Line may no longer be needed.
|
|
188
|
+
// source.wrapX = false;
|
|
186
189
|
return new Image({
|
|
187
190
|
source: source,
|
|
188
191
|
visible: options.visible,
|