@corpsmap/corpsmap 4.1.26 → 4.1.28
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 +6618 -6251
- package/dist/corpsmap.umd.js +17 -17
- package/package.json +1 -1
- package/src/application-bundles/map-layers-bundle.js +1 -0
- package/src/core-plugins/identify/listeners/arcgis.js +5 -0
- package/src/core-plugins/identify-arcgis-rest/bundle.js +5 -0
- package/src/core-plugins/identify-geoserver/bundle.js +159 -0
- package/src/core-plugins/identify-geoserver/index.js +10 -0
- package/src/core-plugins/identify-map-server/bundle.js +159 -0
- package/src/core-plugins/identify-map-server/index.js +10 -0
- package/src/index.jsx +4 -0
package/package.json
CHANGED
|
@@ -79,6 +79,11 @@ export default {
|
|
|
79
79
|
const layerList = visibleLayer.layerList;
|
|
80
80
|
params["layers"] = `all:${layerList}`;
|
|
81
81
|
const p = Object.assign({}, params, { root: visibleLayer.url });
|
|
82
|
+
if (visibleLayer.params && visibleLayer.params.layerDefs) {
|
|
83
|
+
p.layerDefs = encodeURIComponent(
|
|
84
|
+
decodeURIComponent(visibleLayer.params.layerDefs)
|
|
85
|
+
);
|
|
86
|
+
}
|
|
82
87
|
const url = formatUrl(p);
|
|
83
88
|
|
|
84
89
|
queries.push((cb) => {
|
|
@@ -84,6 +84,11 @@ export default {
|
|
|
84
84
|
const layerList = visibleLayer.layerList;
|
|
85
85
|
params["layers"] = `all:${layerList}`;
|
|
86
86
|
const p = Object.assign({}, params, { root: root });
|
|
87
|
+
if (visibleLayer.params && visibleLayer.params.layerDefs) {
|
|
88
|
+
p.layerDefs = encodeURIComponent(
|
|
89
|
+
decodeURIComponent(visibleLayer.params.layerDefs)
|
|
90
|
+
);
|
|
91
|
+
}
|
|
87
92
|
|
|
88
93
|
const url = formatUrl(p);
|
|
89
94
|
queries.push((cb) => {
|
|
@@ -0,0 +1,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
|
+
function buildGeoserverUrl(lyr, extent) {
|
|
13
|
+
return [
|
|
14
|
+
`${lyr.url}`,
|
|
15
|
+
`?service=WFS`,
|
|
16
|
+
`&version=1.1.0`,
|
|
17
|
+
`&request=GetFeature`,
|
|
18
|
+
`&bbox=${extent[0]},${extent[1]},${extent[2]},${extent[3]},EPSG:4326`,
|
|
19
|
+
`&typeName=${lyr.layerList}`,
|
|
20
|
+
`&outputFormat=application%2Fjson`,
|
|
21
|
+
].join("");
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default {
|
|
25
|
+
name: "geoserverIdent",
|
|
26
|
+
|
|
27
|
+
getReducer() {
|
|
28
|
+
const initialData = {
|
|
29
|
+
shouldRegister: true,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
return (state = initialData, { type, payload }) => {
|
|
33
|
+
switch (type) {
|
|
34
|
+
case "GEOSERVER_IDENT_REGISTERED":
|
|
35
|
+
return Object.assign({}, state, payload);
|
|
36
|
+
default:
|
|
37
|
+
return state;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
doGeoserverIdentRegister:
|
|
43
|
+
() =>
|
|
44
|
+
({ dispatch, store }) => {
|
|
45
|
+
dispatch({
|
|
46
|
+
type: "GEOSERVER_IDENT_REGISTERED",
|
|
47
|
+
payload: { shouldRegister: false },
|
|
48
|
+
});
|
|
49
|
+
store.doIdentifyAddCollection({
|
|
50
|
+
onIdentify: store.doGeoserverIdentFire,
|
|
51
|
+
});
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
doGeoserverIdentFire:
|
|
55
|
+
(callback) =>
|
|
56
|
+
({ store, anonGet }) => {
|
|
57
|
+
const visibleLayers = store.selectVisibleLayers();
|
|
58
|
+
const identifyFeature = store.doSetIdentifyFeature();
|
|
59
|
+
const extent = bbox(identifyFeature);
|
|
60
|
+
const excludedColumns = store.selectIdentifyColumnsExclude();
|
|
61
|
+
const queries = [];
|
|
62
|
+
|
|
63
|
+
visibleLayers.forEach((lyr) => {
|
|
64
|
+
if (lyr.identifyType && lyr.identifyType === "ORM-GEOSERVER") {
|
|
65
|
+
const url = buildGeoserverUrl(lyr, extent);
|
|
66
|
+
|
|
67
|
+
queries.push((cb) => {
|
|
68
|
+
anonGet(url, (err, response, body) => {
|
|
69
|
+
if (err || response.statusCode !== 200) {
|
|
70
|
+
return cb(null, {
|
|
71
|
+
dataset: lyr.uid,
|
|
72
|
+
layerName: lyr.displayName,
|
|
73
|
+
err: `Error for ${lyr.displayName}`,
|
|
74
|
+
result: { [lyr.uid]: {} },
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
try {
|
|
78
|
+
const data = JSON.parse(body);
|
|
79
|
+
let outFeatures = data.features
|
|
80
|
+
.filter((feature) => !disjoint(feature, identifyFeature))
|
|
81
|
+
.map((feature) => {
|
|
82
|
+
if (feature.properties.LATITUDE) {
|
|
83
|
+
feature.properties.LATITUDE = Number(
|
|
84
|
+
feature.properties.LATITUDE
|
|
85
|
+
).toFixed(6);
|
|
86
|
+
}
|
|
87
|
+
if (feature.properties.LONGITUDE) {
|
|
88
|
+
feature.properties.LONGITUDE = Number(
|
|
89
|
+
feature.properties.LONGITUDE
|
|
90
|
+
).toFixed(6);
|
|
91
|
+
}
|
|
92
|
+
return feature;
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
outFeatures = identifyExcludeColumnsArcgisvector(
|
|
96
|
+
outFeatures,
|
|
97
|
+
excludedColumns
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
if (lyr.identifyFields) {
|
|
101
|
+
outFeatures = identifyIncludeColumnsArcgisvector(
|
|
102
|
+
outFeatures,
|
|
103
|
+
lyr.identifyFields
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const identifyRenameColumns =
|
|
108
|
+
lyr.identifyRenameColumns ?? lyr.identifyRenameColums;
|
|
109
|
+
if (identifyRenameColumns) {
|
|
110
|
+
outFeatures = identifyRenameColumnsArcgisvector(
|
|
111
|
+
outFeatures,
|
|
112
|
+
identifyRenameColumns
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (lyr.identifyFormatColumns) {
|
|
117
|
+
outFeatures = identifyFormatColumnsArcgisvector(
|
|
118
|
+
outFeatures,
|
|
119
|
+
lyr.identifyFormatColumns
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
outFeatures = formatArcgisVector(outFeatures);
|
|
124
|
+
|
|
125
|
+
return cb(null, {
|
|
126
|
+
dataset: lyr.uid,
|
|
127
|
+
layerName: lyr.displayName,
|
|
128
|
+
err: null,
|
|
129
|
+
result: {
|
|
130
|
+
[lyr.uid]: {
|
|
131
|
+
type: "FeatureCollection",
|
|
132
|
+
features: outFeatures,
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
});
|
|
136
|
+
} catch (parseErr) {
|
|
137
|
+
console.log(parseErr);
|
|
138
|
+
return cb(null, {
|
|
139
|
+
dataset: lyr.uid,
|
|
140
|
+
layerName: lyr.displayName,
|
|
141
|
+
err: `Error for ${lyr.displayName}`,
|
|
142
|
+
result: { [lyr.uid]: {} },
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
async.parallel(queries, (err, results) => {
|
|
151
|
+
callback(err, results);
|
|
152
|
+
});
|
|
153
|
+
},
|
|
154
|
+
|
|
155
|
+
reactGeoserverIdentShouldRegister: (state) => {
|
|
156
|
+
if (state.geoserverIdent.shouldRegister)
|
|
157
|
+
return { actionCreator: "doGeoserverIdentRegister" };
|
|
158
|
+
},
|
|
159
|
+
};
|
|
@@ -0,0 +1,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
|
+
function buildMapServerUrl(lyr, extent) {
|
|
13
|
+
return [
|
|
14
|
+
`${lyr.url}`,
|
|
15
|
+
`?service=WFS`,
|
|
16
|
+
`&version=1.0.0`,
|
|
17
|
+
`&request=GetFeature`,
|
|
18
|
+
`&bbox=${extent[0]},${extent[1]},${extent[2]},${extent[3]},EPSG:4326`,
|
|
19
|
+
`&typeName=${lyr.layerList}`,
|
|
20
|
+
`&outputFormat=application%2Fjson`,
|
|
21
|
+
].join("");
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default {
|
|
25
|
+
name: "mapServerIdent",
|
|
26
|
+
|
|
27
|
+
getReducer() {
|
|
28
|
+
const initialData = {
|
|
29
|
+
shouldRegister: true,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
return (state = initialData, { type, payload }) => {
|
|
33
|
+
switch (type) {
|
|
34
|
+
case "MAP_SERVER_IDENT_REGISTERED":
|
|
35
|
+
return Object.assign({}, state, payload);
|
|
36
|
+
default:
|
|
37
|
+
return state;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
doMapServerIdentRegister:
|
|
43
|
+
() =>
|
|
44
|
+
({ dispatch, store }) => {
|
|
45
|
+
dispatch({
|
|
46
|
+
type: "MAP_SERVER_IDENT_REGISTERED",
|
|
47
|
+
payload: { shouldRegister: false },
|
|
48
|
+
});
|
|
49
|
+
store.doIdentifyAddCollection({
|
|
50
|
+
onIdentify: store.doMapServerIdentFire,
|
|
51
|
+
});
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
doMapServerIdentFire:
|
|
55
|
+
(callback) =>
|
|
56
|
+
({ store, anonGet }) => {
|
|
57
|
+
const visibleLayers = store.selectVisibleLayers();
|
|
58
|
+
const identifyFeature = store.doSetIdentifyFeature();
|
|
59
|
+
const extent = bbox(identifyFeature);
|
|
60
|
+
const excludedColumns = store.selectIdentifyColumnsExclude();
|
|
61
|
+
const queries = [];
|
|
62
|
+
|
|
63
|
+
visibleLayers.forEach((lyr) => {
|
|
64
|
+
if (lyr.identifyType && lyr.identifyType === "MAP") {
|
|
65
|
+
const url = buildMapServerUrl(lyr, extent);
|
|
66
|
+
|
|
67
|
+
queries.push((cb) => {
|
|
68
|
+
anonGet(url, (err, response, body) => {
|
|
69
|
+
if (err || response.statusCode !== 200) {
|
|
70
|
+
return cb(null, {
|
|
71
|
+
dataset: lyr.uid,
|
|
72
|
+
layerName: lyr.displayName,
|
|
73
|
+
err: `Error for ${lyr.displayName}`,
|
|
74
|
+
result: { [lyr.uid]: {} },
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
try {
|
|
78
|
+
const data = JSON.parse(body);
|
|
79
|
+
let outFeatures = data.features
|
|
80
|
+
.filter((feature) => !disjoint(feature, identifyFeature))
|
|
81
|
+
.map((feature) => {
|
|
82
|
+
if (feature.properties.LATITUDE) {
|
|
83
|
+
feature.properties.LATITUDE = Number(
|
|
84
|
+
feature.properties.LATITUDE
|
|
85
|
+
).toFixed(6);
|
|
86
|
+
}
|
|
87
|
+
if (feature.properties.LONGITUDE) {
|
|
88
|
+
feature.properties.LONGITUDE = Number(
|
|
89
|
+
feature.properties.LONGITUDE
|
|
90
|
+
).toFixed(6);
|
|
91
|
+
}
|
|
92
|
+
return feature;
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
outFeatures = identifyExcludeColumnsArcgisvector(
|
|
96
|
+
outFeatures,
|
|
97
|
+
excludedColumns
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
if (lyr.identifyFields) {
|
|
101
|
+
outFeatures = identifyIncludeColumnsArcgisvector(
|
|
102
|
+
outFeatures,
|
|
103
|
+
lyr.identifyFields
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const identifyRenameColumns =
|
|
108
|
+
lyr.identifyRenameColumns ?? lyr.identifyRenameColums;
|
|
109
|
+
if (identifyRenameColumns) {
|
|
110
|
+
outFeatures = identifyRenameColumnsArcgisvector(
|
|
111
|
+
outFeatures,
|
|
112
|
+
identifyRenameColumns
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (lyr.identifyFormatColumns) {
|
|
117
|
+
outFeatures = identifyFormatColumnsArcgisvector(
|
|
118
|
+
outFeatures,
|
|
119
|
+
lyr.identifyFormatColumns
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
outFeatures = formatArcgisVector(outFeatures);
|
|
124
|
+
|
|
125
|
+
return cb(null, {
|
|
126
|
+
dataset: lyr.uid,
|
|
127
|
+
layerName: lyr.displayName,
|
|
128
|
+
err: null,
|
|
129
|
+
result: {
|
|
130
|
+
[lyr.uid]: {
|
|
131
|
+
type: "FeatureCollection",
|
|
132
|
+
features: outFeatures,
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
});
|
|
136
|
+
} catch (parseErr) {
|
|
137
|
+
console.log(parseErr);
|
|
138
|
+
return cb(null, {
|
|
139
|
+
dataset: lyr.uid,
|
|
140
|
+
layerName: lyr.displayName,
|
|
141
|
+
err: `Error for ${lyr.displayName}`,
|
|
142
|
+
result: { [lyr.uid]: {} },
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
async.parallel(queries, (err, results) => {
|
|
151
|
+
callback(err, results);
|
|
152
|
+
});
|
|
153
|
+
},
|
|
154
|
+
|
|
155
|
+
reactMapServerIdentShouldRegister: (state) => {
|
|
156
|
+
if (state.mapServerIdent.shouldRegister)
|
|
157
|
+
return { actionCreator: "doMapServerIdentRegister" };
|
|
158
|
+
},
|
|
159
|
+
};
|
package/src/index.jsx
CHANGED
|
@@ -38,6 +38,8 @@ import geocoder from "./core-plugins/geocoder";
|
|
|
38
38
|
import geojsonIdent from "./core-plugins/identify-geojson";
|
|
39
39
|
import esriIdent from "./core-plugins/identify-arcgis-rest";
|
|
40
40
|
import identify from "./core-plugins/identify";
|
|
41
|
+
import geoserverIdent from "./core-plugins/identify-geoserver";
|
|
42
|
+
import mapServerIdent from "./core-plugins/identify-map-server";
|
|
41
43
|
import legend from "./core-plugins/legend";
|
|
42
44
|
// import login from './core-plugins/login';
|
|
43
45
|
import measureTools from "./core-plugins/measure-tools";
|
|
@@ -93,6 +95,8 @@ export {
|
|
|
93
95
|
geojsonIdent,
|
|
94
96
|
esriIdent,
|
|
95
97
|
identify,
|
|
98
|
+
geoserverIdent,
|
|
99
|
+
mapServerIdent,
|
|
96
100
|
legend,
|
|
97
101
|
// // login,
|
|
98
102
|
mapLoadingIndicator,
|