@corpsmap/corpsmap 4.1.28 → 4.1.31
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/dist/corpsmap.css +1 -1
- package/dist/corpsmap.es.js +5987 -5712
- package/dist/corpsmap.umd.js +24 -24
- package/package.json +1 -1
- package/src/application-bundles/map-layers-bundle.js +2 -1
- package/src/config/default-config.js +20 -20
- package/src/core-plugins/identify-map-server/bundle.js +215 -159
- package/src/core-plugins/zoom-home/bundle.js +0 -1
- package/src/core-plugins/zoom-home/index.js +0 -1
- package/src/core-plugins/zoom-in-out/index.js +0 -1
- package/src/core-plugins/zoom-level/bundle.js +0 -1
- package/src/core-plugins/zoom-to-box/bundle.js +0 -1
package/package.json
CHANGED
|
@@ -41,6 +41,7 @@ const createNode = (options, map) => {
|
|
|
41
41
|
url: options.url,
|
|
42
42
|
info: options.info,
|
|
43
43
|
identifyType: options.identifyType,
|
|
44
|
+
identifyLayers: options.identifyLayers,
|
|
44
45
|
identifyFields: options.identifyFields,
|
|
45
46
|
identifyRenameColums: options.identifyRenameColums,
|
|
46
47
|
identifyFormatColumns: options.identifyFormatColumns,
|
|
@@ -415,7 +416,7 @@ export default {
|
|
|
415
416
|
displayName: "New Folder",
|
|
416
417
|
type: "Folder",
|
|
417
418
|
},
|
|
418
|
-
map
|
|
419
|
+
map,
|
|
419
420
|
);
|
|
420
421
|
|
|
421
422
|
node.parent = newFolder;
|
|
@@ -182,26 +182,26 @@ const config = {
|
|
|
182
182
|
"Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community",
|
|
183
183
|
visible: false,
|
|
184
184
|
},
|
|
185
|
-
{
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
},
|
|
195
|
-
{
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
},
|
|
185
|
+
// {
|
|
186
|
+
// id: "CartoDBDarkMatter",
|
|
187
|
+
// name: "CartoDB Dark Matter",
|
|
188
|
+
// url: "https://cartodb-basemaps-{a-d}.global.ssl.fastly.net/dark_all/{z}/{x}/{y}.png",
|
|
189
|
+
// attributions:
|
|
190
|
+
// '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> © <a href="https://cartodb.com/attributionss">CartoDB</a>',
|
|
191
|
+
// subdomains: "abcd",
|
|
192
|
+
// maxZoom: 19,
|
|
193
|
+
// visible: false,
|
|
194
|
+
// },
|
|
195
|
+
// {
|
|
196
|
+
// id: "CartoDBPositron",
|
|
197
|
+
// name: "CartoDB Positron",
|
|
198
|
+
// url: "https://cartodb-basemaps-{a-d}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png",
|
|
199
|
+
// attributions:
|
|
200
|
+
// '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> © <a href="https://cartodb.com/attributionss">CartoDB</a>',
|
|
201
|
+
// subdomains: "abcd",
|
|
202
|
+
// maxZoom: 19,
|
|
203
|
+
// visible: false,
|
|
204
|
+
// },
|
|
205
205
|
],
|
|
206
206
|
datasetsDontUse: [
|
|
207
207
|
{
|
|
@@ -1,159 +1,215 @@
|
|
|
1
|
-
import async from "async";
|
|
2
|
-
import disjoint from "@turf/boolean-disjoint";
|
|
3
|
-
import bbox from "@turf/bbox";
|
|
4
|
-
import {
|
|
5
|
-
formatArcgisVector,
|
|
6
|
-
identifyExcludeColumnsArcgisvector,
|
|
7
|
-
identifyIncludeColumnsArcgisvector,
|
|
8
|
-
identifyRenameColumnsArcgisvector,
|
|
9
|
-
identifyFormatColumnsArcgisvector,
|
|
10
|
-
} from "../../openlayers-utils/format-utilities";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
`&
|
|
18
|
-
`&
|
|
19
|
-
`&
|
|
20
|
-
`&
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
1
|
+
import async from "async";
|
|
2
|
+
import disjoint from "@turf/boolean-disjoint";
|
|
3
|
+
import bbox from "@turf/bbox";
|
|
4
|
+
import {
|
|
5
|
+
formatArcgisVector,
|
|
6
|
+
identifyExcludeColumnsArcgisvector,
|
|
7
|
+
identifyIncludeColumnsArcgisvector,
|
|
8
|
+
identifyRenameColumnsArcgisvector,
|
|
9
|
+
identifyFormatColumnsArcgisvector,
|
|
10
|
+
} from "../../openlayers-utils/format-utilities";
|
|
11
|
+
|
|
12
|
+
// typeName is passed in so one layer can issue several requests (see identifyLayers below).
|
|
13
|
+
function buildMapServerUrl(lyr, typeName, extent) {
|
|
14
|
+
return [
|
|
15
|
+
`${lyr.url}`,
|
|
16
|
+
`?service=WFS`,
|
|
17
|
+
`&version=1.0.0`,
|
|
18
|
+
`&request=GetFeature`,
|
|
19
|
+
`&bbox=${extent[0]},${extent[1]},${extent[2]},${extent[3]},EPSG:4326`,
|
|
20
|
+
`&typeName=${typeName}`,
|
|
21
|
+
`&outputFormat=application%2Fjson`,
|
|
22
|
+
].join("");
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Work out which WFS requests to send for a layer.
|
|
27
|
+
*
|
|
28
|
+
* A layer with a non-empty `identifyLayers` array (e.g. a MapServer group such as a
|
|
29
|
+
* FUDS Top 10 site) sends one request per entry:
|
|
30
|
+
* identifyLayers: [{ layerList: "internal_property", displayName: "Property" }, ...]
|
|
31
|
+
* Results for those requests are keyed `${lyr.uid}:${displayName}`, which the identify
|
|
32
|
+
* UI splits on ":" to show "<layer name>:<displayName>".
|
|
33
|
+
*
|
|
34
|
+
* A layer without `identifyLayers` sends a single request using `layerList` and keeps
|
|
35
|
+
* the original result key (`lyr.uid`), so its behaviour is unchanged.
|
|
36
|
+
*/
|
|
37
|
+
function getIdentifyTargets(lyr) {
|
|
38
|
+
const hasIdentifyLayers =
|
|
39
|
+
Array.isArray(lyr.identifyLayers) && lyr.identifyLayers.length > 0;
|
|
40
|
+
|
|
41
|
+
if (!hasIdentifyLayers) {
|
|
42
|
+
return [
|
|
43
|
+
{
|
|
44
|
+
typeName: lyr.layerList,
|
|
45
|
+
resultKey: lyr.uid,
|
|
46
|
+
layerName: lyr.displayName,
|
|
47
|
+
label: lyr.id,
|
|
48
|
+
},
|
|
49
|
+
];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return lyr.identifyLayers
|
|
53
|
+
.filter((entry) => {
|
|
54
|
+
if (entry && entry.layerList) return true;
|
|
55
|
+
console.warn(
|
|
56
|
+
`[mapServerIdent] ${lyr.id}: identifyLayers entry has no layerList, skipping`,
|
|
57
|
+
entry
|
|
58
|
+
);
|
|
59
|
+
return false;
|
|
60
|
+
})
|
|
61
|
+
.map((entry) => {
|
|
62
|
+
const name = entry.displayName || entry.layerList;
|
|
63
|
+
return {
|
|
64
|
+
typeName: entry.layerList,
|
|
65
|
+
resultKey: `${lyr.uid}:${name}`,
|
|
66
|
+
layerName: `${lyr.displayName}:${name}`,
|
|
67
|
+
label: `${lyr.id}/${entry.layerList}`,
|
|
68
|
+
};
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export default {
|
|
73
|
+
name: "mapServerIdent",
|
|
74
|
+
|
|
75
|
+
getReducer() {
|
|
76
|
+
const initialData = {
|
|
77
|
+
shouldRegister: true,
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
return (state = initialData, { type, payload }) => {
|
|
81
|
+
switch (type) {
|
|
82
|
+
case "MAP_SERVER_IDENT_REGISTERED":
|
|
83
|
+
return Object.assign({}, state, payload);
|
|
84
|
+
default:
|
|
85
|
+
return state;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
doMapServerIdentRegister:
|
|
91
|
+
() =>
|
|
92
|
+
({ dispatch, store }) => {
|
|
93
|
+
dispatch({
|
|
94
|
+
type: "MAP_SERVER_IDENT_REGISTERED",
|
|
95
|
+
payload: { shouldRegister: false },
|
|
96
|
+
});
|
|
97
|
+
store.doIdentifyAddCollection({
|
|
98
|
+
onIdentify: store.doMapServerIdentFire,
|
|
99
|
+
});
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
doMapServerIdentFire:
|
|
103
|
+
(callback) =>
|
|
104
|
+
({ store, anonGet }) => {
|
|
105
|
+
const visibleLayers = store.selectVisibleLayers();
|
|
106
|
+
const identifyFeature = store.doSetIdentifyFeature();
|
|
107
|
+
const extent = bbox(identifyFeature);
|
|
108
|
+
const excludedColumns = store.selectIdentifyColumnsExclude();
|
|
109
|
+
const queries = [];
|
|
110
|
+
|
|
111
|
+
visibleLayers.forEach((lyr) => {
|
|
112
|
+
if (lyr.identifyType && lyr.identifyType === "MAP") {
|
|
113
|
+
const targets = getIdentifyTargets(lyr);
|
|
114
|
+
|
|
115
|
+
targets.forEach((target) => {
|
|
116
|
+
const url = buildMapServerUrl(lyr, target.typeName, extent);
|
|
117
|
+
|
|
118
|
+
queries.push((cb) => {
|
|
119
|
+
anonGet(url, (err, response, body) => {
|
|
120
|
+
if (err || response.statusCode !== 200) {
|
|
121
|
+
return cb(null, {
|
|
122
|
+
dataset: lyr.uid,
|
|
123
|
+
layerName: target.layerName,
|
|
124
|
+
err: `Error for ${target.layerName}`,
|
|
125
|
+
result: { [target.resultKey]: {} },
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
try {
|
|
129
|
+
const data = JSON.parse(body);
|
|
130
|
+
let outFeatures = data.features
|
|
131
|
+
.filter((feature) => !disjoint(feature, identifyFeature))
|
|
132
|
+
.map((feature) => {
|
|
133
|
+
if (feature.properties.LATITUDE) {
|
|
134
|
+
feature.properties.LATITUDE = Number(
|
|
135
|
+
feature.properties.LATITUDE
|
|
136
|
+
).toFixed(6);
|
|
137
|
+
}
|
|
138
|
+
if (feature.properties.LONGITUDE) {
|
|
139
|
+
feature.properties.LONGITUDE = Number(
|
|
140
|
+
feature.properties.LONGITUDE
|
|
141
|
+
).toFixed(6);
|
|
142
|
+
}
|
|
143
|
+
return feature;
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
outFeatures = identifyExcludeColumnsArcgisvector(
|
|
147
|
+
outFeatures,
|
|
148
|
+
excludedColumns
|
|
149
|
+
);
|
|
150
|
+
|
|
151
|
+
// Column options come from the parent layer; for FUDS Top 10 these are
|
|
152
|
+
// all null, so every sub-layer returns all of its columns.
|
|
153
|
+
if (lyr.identifyFields) {
|
|
154
|
+
outFeatures = identifyIncludeColumnsArcgisvector(
|
|
155
|
+
outFeatures,
|
|
156
|
+
lyr.identifyFields
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const identifyRenameColumns =
|
|
161
|
+
lyr.identifyRenameColumns ?? lyr.identifyRenameColums;
|
|
162
|
+
if (identifyRenameColumns) {
|
|
163
|
+
outFeatures = identifyRenameColumnsArcgisvector(
|
|
164
|
+
outFeatures,
|
|
165
|
+
identifyRenameColumns
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if (lyr.identifyFormatColumns) {
|
|
170
|
+
outFeatures = identifyFormatColumnsArcgisvector(
|
|
171
|
+
outFeatures,
|
|
172
|
+
lyr.identifyFormatColumns
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
outFeatures = formatArcgisVector(outFeatures);
|
|
177
|
+
|
|
178
|
+
// dataset stays lyr.uid (the UI looks the layer name up with it); the
|
|
179
|
+
// result key carries the sub-layer name for identifyLayers entries.
|
|
180
|
+
|
|
181
|
+
return cb(null, {
|
|
182
|
+
dataset: lyr.uid,
|
|
183
|
+
layerName: target.layerName,
|
|
184
|
+
err: null,
|
|
185
|
+
result: {
|
|
186
|
+
[target.resultKey]: {
|
|
187
|
+
type: "FeatureCollection",
|
|
188
|
+
features: outFeatures,
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
});
|
|
192
|
+
} catch (parseErr) {
|
|
193
|
+
return cb(null, {
|
|
194
|
+
dataset: lyr.uid,
|
|
195
|
+
layerName: target.layerName,
|
|
196
|
+
err: `Error for ${target.layerName}`,
|
|
197
|
+
result: { [target.resultKey]: {} },
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
});
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
async.parallel(queries, (err, results) => {
|
|
207
|
+
callback(err, results);
|
|
208
|
+
});
|
|
209
|
+
},
|
|
210
|
+
|
|
211
|
+
reactMapServerIdentShouldRegister: (state) => {
|
|
212
|
+
if (state.mapServerIdent.shouldRegister)
|
|
213
|
+
return { actionCreator: "doMapServerIdentRegister" };
|
|
214
|
+
},
|
|
215
|
+
};
|