@corpsmap/corpsmap 4.1.24 → 4.1.25
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.es.js +677 -580
- package/dist/corpsmap.umd.js +16 -16
- package/package.json +1 -1
- package/src/core-plugins/{identify-orm-geoserver → identify-geoserver}/bundle.js +13 -17
- package/src/core-plugins/{identify-orm-geoserver → identify-geoserver}/index.js +1 -1
- 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 -2
package/package.json
CHANGED
|
@@ -9,12 +9,11 @@ import {
|
|
|
9
9
|
identifyFormatColumnsArcgisvector,
|
|
10
10
|
} from "../../openlayers-utils/format-utilities";
|
|
11
11
|
|
|
12
|
-
function
|
|
13
|
-
const version = lyr.identifyType === "MAP" ? "1.0.0" : "1.1.0";
|
|
12
|
+
function buildGeoserverUrl(lyr, extent) {
|
|
14
13
|
return [
|
|
15
14
|
`${lyr.url}`,
|
|
16
15
|
`?service=WFS`,
|
|
17
|
-
`&version
|
|
16
|
+
`&version=1.1.0`,
|
|
18
17
|
`&request=GetFeature`,
|
|
19
18
|
`&bbox=${extent[0]},${extent[1]},${extent[2]},${extent[3]},EPSG:4326`,
|
|
20
19
|
`&typeName=${lyr.layerList}`,
|
|
@@ -23,7 +22,7 @@ function buildOrmGeoserverUrl(lyr, extent) {
|
|
|
23
22
|
}
|
|
24
23
|
|
|
25
24
|
export default {
|
|
26
|
-
name: "
|
|
25
|
+
name: "geoserverIdent",
|
|
27
26
|
|
|
28
27
|
getReducer() {
|
|
29
28
|
const initialData = {
|
|
@@ -32,7 +31,7 @@ export default {
|
|
|
32
31
|
|
|
33
32
|
return (state = initialData, { type, payload }) => {
|
|
34
33
|
switch (type) {
|
|
35
|
-
case "
|
|
34
|
+
case "GEOSERVER_IDENT_REGISTERED":
|
|
36
35
|
return Object.assign({}, state, payload);
|
|
37
36
|
default:
|
|
38
37
|
return state;
|
|
@@ -40,19 +39,19 @@ export default {
|
|
|
40
39
|
};
|
|
41
40
|
},
|
|
42
41
|
|
|
43
|
-
|
|
42
|
+
doGeoserverIdentRegister:
|
|
44
43
|
() =>
|
|
45
44
|
({ dispatch, store }) => {
|
|
46
45
|
dispatch({
|
|
47
|
-
type: "
|
|
46
|
+
type: "GEOSERVER_IDENT_REGISTERED",
|
|
48
47
|
payload: { shouldRegister: false },
|
|
49
48
|
});
|
|
50
49
|
store.doIdentifyAddCollection({
|
|
51
|
-
onIdentify: store.
|
|
50
|
+
onIdentify: store.doGeoserverIdentFire,
|
|
52
51
|
});
|
|
53
52
|
},
|
|
54
53
|
|
|
55
|
-
|
|
54
|
+
doGeoserverIdentFire:
|
|
56
55
|
(callback) =>
|
|
57
56
|
({ store, anonGet }) => {
|
|
58
57
|
const visibleLayers = store.selectVisibleLayers();
|
|
@@ -62,11 +61,8 @@ export default {
|
|
|
62
61
|
const queries = [];
|
|
63
62
|
|
|
64
63
|
visibleLayers.forEach((lyr) => {
|
|
65
|
-
if (
|
|
66
|
-
lyr
|
|
67
|
-
(lyr.identifyType === "ORM-GEOSERVER" || lyr.identifyType === "MAP")
|
|
68
|
-
) {
|
|
69
|
-
const url = buildOrmGeoserverUrl(lyr, extent);
|
|
64
|
+
if (lyr.identifyType && lyr.identifyType === "ORM-GEOSERVER") {
|
|
65
|
+
const url = buildGeoserverUrl(lyr, extent);
|
|
70
66
|
|
|
71
67
|
queries.push((cb) => {
|
|
72
68
|
anonGet(url, (err, response, body) => {
|
|
@@ -156,8 +152,8 @@ export default {
|
|
|
156
152
|
});
|
|
157
153
|
},
|
|
158
154
|
|
|
159
|
-
|
|
160
|
-
if (state.
|
|
161
|
-
return { actionCreator: "
|
|
155
|
+
reactGeoserverIdentShouldRegister: (state) => {
|
|
156
|
+
if (state.geoserverIdent.shouldRegister)
|
|
157
|
+
return { actionCreator: "doGeoserverIdentRegister" };
|
|
162
158
|
},
|
|
163
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,7 +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
|
|
41
|
+
import geoserverIdent from "./core-plugins/identify-geoserver";
|
|
42
|
+
import mapServerIdent from "./core-plugins/identify-map-server";
|
|
42
43
|
import legend from "./core-plugins/legend";
|
|
43
44
|
// import login from './core-plugins/login';
|
|
44
45
|
import measureTools from "./core-plugins/measure-tools";
|
|
@@ -94,7 +95,8 @@ export {
|
|
|
94
95
|
geojsonIdent,
|
|
95
96
|
esriIdent,
|
|
96
97
|
identify,
|
|
97
|
-
|
|
98
|
+
geoserverIdent,
|
|
99
|
+
mapServerIdent,
|
|
98
100
|
legend,
|
|
99
101
|
// // login,
|
|
100
102
|
mapLoadingIndicator,
|