@corpsmap/corpsmap 3.2.21 → 3.2.23
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 +125 -11
- package/lib/prod.js +125 -11
- package/package.json +1 -1
- package/src/core-plugins/identify/listeners/arcgis.js +7 -3
- package/src/core-plugins/identify/listeners/vector.js +20 -2
- package/src/core-plugins/identify-arcgis-rest/bundle.js +2 -1
- package/src/core-plugins/identify-vector/bundle.js +2 -1
- package/src/openlayers-utils/format-utilities.js +81 -9
package/lib/dev.js
CHANGED
|
@@ -106567,7 +106567,7 @@ var config = {
|
|
|
106567
106567
|
};
|
|
106568
106568
|
|
|
106569
106569
|
var name = "@corpsmap/corpsmap";
|
|
106570
|
-
var version$1 = "3.2.
|
|
106570
|
+
var version$1 = "3.2.23";
|
|
106571
106571
|
var description = "CorpsMap as React Components";
|
|
106572
106572
|
var main = "index.js";
|
|
106573
106573
|
var scripts = {
|
|
@@ -132863,15 +132863,13 @@ var formatArcgisVector = function formatArcgisVector(results) {
|
|
|
132863
132863
|
if (result) {
|
|
132864
132864
|
feat.properties[key] = "<a href=\"".concat(value, "\" target=\"_new\" > ").concat(value, " </a>");
|
|
132865
132865
|
} // Format UNIX Date
|
|
132866
|
+
// if ((key === "fromdate" || key === "todate" || key === "referencedate") && Number.isInteger(feat.properties[key])) {
|
|
132867
|
+
// const unixTimestamp = feat.properties[key];
|
|
132868
|
+
// const milliseconds = unixTimestamp // * 1000 in some cases.
|
|
132869
|
+
// const dateObject = new Date(milliseconds);
|
|
132870
|
+
// feat.properties[key] = dateObject.toLocaleString();
|
|
132871
|
+
// }
|
|
132866
132872
|
|
|
132867
|
-
|
|
132868
|
-
if ((key === "fromdate" || key === "todate" || key === "referencedate") && Number.isInteger(feat.properties[key])) {
|
|
132869
|
-
var unixTimestamp = feat.properties[key];
|
|
132870
|
-
var milliseconds = unixTimestamp; // * 1000 in some cases.
|
|
132871
|
-
|
|
132872
|
-
var dateObject = new Date(milliseconds);
|
|
132873
|
-
feat.properties[key] = dateObject.toLocaleString();
|
|
132874
|
-
}
|
|
132875
132873
|
}
|
|
132876
132874
|
});
|
|
132877
132875
|
return results;
|
|
@@ -132890,7 +132888,7 @@ var identifyColumnsArcgisrest = function identifyColumnsArcgisrest(data, exclude
|
|
|
132890
132888
|
return data;
|
|
132891
132889
|
};
|
|
132892
132890
|
|
|
132893
|
-
var
|
|
132891
|
+
var identifyExcludeColumnsArcgisvector = function identifyExcludeColumnsArcgisvector(data, excludedColumns) {
|
|
132894
132892
|
data.forEach(function (feature) {
|
|
132895
132893
|
if (feature.properties) {
|
|
132896
132894
|
excludedColumns.forEach(function (column) {
|
|
@@ -132903,6 +132901,101 @@ var identifyColumnsArcgisvector = function identifyColumnsArcgisvector(data, exc
|
|
|
132903
132901
|
return data;
|
|
132904
132902
|
};
|
|
132905
132903
|
|
|
132904
|
+
var identifyIncludeColumnsArcgisvector = function identifyIncludeColumnsArcgisvector(data, identifyFields) {
|
|
132905
|
+
data.forEach(function (feature) {
|
|
132906
|
+
console.log(feature, feature.properties);
|
|
132907
|
+
|
|
132908
|
+
if (feature.properties) {
|
|
132909
|
+
var _loop = function _loop() {
|
|
132910
|
+
var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i3], 2),
|
|
132911
|
+
key = _Object$entries3$_i[0],
|
|
132912
|
+
value = _Object$entries3$_i[1];
|
|
132913
|
+
|
|
132914
|
+
var reducedProperties = {};
|
|
132915
|
+
identifyFields.forEach(function (property) {
|
|
132916
|
+
if (feature.properties[property]) {
|
|
132917
|
+
reducedProperties[property] = feature.properties[property];
|
|
132918
|
+
}
|
|
132919
|
+
});
|
|
132920
|
+
feature.properties = reducedProperties;
|
|
132921
|
+
};
|
|
132922
|
+
|
|
132923
|
+
for (var _i3 = 0, _Object$entries3 = Object.entries(feature.properties); _i3 < _Object$entries3.length; _i3++) {
|
|
132924
|
+
_loop();
|
|
132925
|
+
}
|
|
132926
|
+
}
|
|
132927
|
+
});
|
|
132928
|
+
return data;
|
|
132929
|
+
};
|
|
132930
|
+
|
|
132931
|
+
var identifyRenameColumnsArcgisvector = function identifyRenameColumnsArcgisvector(data, identifyRenameColums) {
|
|
132932
|
+
data.forEach(function (feature) {
|
|
132933
|
+
if (feature.properties) {
|
|
132934
|
+
var wkData = {};
|
|
132935
|
+
|
|
132936
|
+
for (var _i4 = 0, _Object$entries4 = Object.entries(feature.properties); _i4 < _Object$entries4.length; _i4++) {
|
|
132937
|
+
var _Object$entries4$_i = _slicedToArray(_Object$entries4[_i4], 2),
|
|
132938
|
+
featureKey = _Object$entries4$_i[0],
|
|
132939
|
+
featureValue = _Object$entries4$_i[1];
|
|
132940
|
+
|
|
132941
|
+
for (var _i5 = 0, _Object$entries5 = Object.entries(identifyRenameColums); _i5 < _Object$entries5.length; _i5++) {
|
|
132942
|
+
var _Object$entries5$_i = _slicedToArray(_Object$entries5[_i5], 2),
|
|
132943
|
+
key = _Object$entries5$_i[0],
|
|
132944
|
+
value = _Object$entries5$_i[1];
|
|
132945
|
+
|
|
132946
|
+
if (featureKey === key) {
|
|
132947
|
+
// feature.properties[value] = feature.properties[featureKey];
|
|
132948
|
+
wkData[value] = feature.properties[featureKey];
|
|
132949
|
+
delete feature.properties[featureKey];
|
|
132950
|
+
}
|
|
132951
|
+
}
|
|
132952
|
+
}
|
|
132953
|
+
|
|
132954
|
+
feature.properties = Object.assign(wkData, feature.properties);
|
|
132955
|
+
}
|
|
132956
|
+
});
|
|
132957
|
+
return data;
|
|
132958
|
+
};
|
|
132959
|
+
|
|
132960
|
+
var identifyFormatColumnsArcgisvector = function identifyFormatColumnsArcgisvector(data, identifyFormatColumns) {
|
|
132961
|
+
data.forEach(function (feature) {
|
|
132962
|
+
if (feature.properties) {
|
|
132963
|
+
for (var _i6 = 0, _Object$entries6 = Object.entries(identifyFormatColumns); _i6 < _Object$entries6.length; _i6++) {
|
|
132964
|
+
var _Object$entries6$_i = _slicedToArray(_Object$entries6[_i6], 2),
|
|
132965
|
+
key = _Object$entries6$_i[0],
|
|
132966
|
+
value = _Object$entries6$_i[1];
|
|
132967
|
+
|
|
132968
|
+
console.log(key, value);
|
|
132969
|
+
|
|
132970
|
+
if (feature.properties.hasOwnProperty(key)) {
|
|
132971
|
+
feature.properties[key] = formatColumns(feature.properties[key], value);
|
|
132972
|
+
}
|
|
132973
|
+
}
|
|
132974
|
+
}
|
|
132975
|
+
});
|
|
132976
|
+
return data;
|
|
132977
|
+
};
|
|
132978
|
+
|
|
132979
|
+
var formatColumns = function formatColumns(value, formatType) {
|
|
132980
|
+
if (formatType === "PERCENT") {
|
|
132981
|
+
value = (value * 100).toFixed(0) + '%';
|
|
132982
|
+
}
|
|
132983
|
+
|
|
132984
|
+
if (formatType === "BOOLEAN") {
|
|
132985
|
+
value = value === 0 ? "No" : "Yes";
|
|
132986
|
+
}
|
|
132987
|
+
|
|
132988
|
+
if (formatType === "UNIXDATE") {
|
|
132989
|
+
var unixTimestamp = value;
|
|
132990
|
+
var milliseconds = unixTimestamp; // * 1000 in some cases.
|
|
132991
|
+
|
|
132992
|
+
var dateObject = new Date(milliseconds);
|
|
132993
|
+
value = dateObject.toLocaleString();
|
|
132994
|
+
}
|
|
132995
|
+
|
|
132996
|
+
return value;
|
|
132997
|
+
};
|
|
132998
|
+
|
|
132906
132999
|
function formatUrl(options) {
|
|
132907
133000
|
var url = "".concat(options.root, "/identify?");
|
|
132908
133001
|
var params = [];
|
|
@@ -142948,7 +143041,8 @@ var ArcGisListener = {
|
|
|
142948
143041
|
var visibleLayers = store.selectVisibleLayers();
|
|
142949
143042
|
if (!visibleLayers.length) return callback(null, []);
|
|
142950
143043
|
var queries = [];
|
|
142951
|
-
var identifyFeature = store.doSetIdentifyFeature();
|
|
143044
|
+
var identifyFeature = store.doSetIdentifyFeature();
|
|
143045
|
+
var excludedColumns = store.selectIdentifyColumnsExclude(); //https://developers.arcgis.com/rest/services-reference/enterprise/identify-map-service-.htm
|
|
142952
143046
|
|
|
142953
143047
|
var params = {
|
|
142954
143048
|
sr: 4326,
|
|
@@ -142987,6 +143081,7 @@ var ArcGisListener = {
|
|
|
142987
143081
|
var data = JSON.parse(body);
|
|
142988
143082
|
|
|
142989
143083
|
if (data.results.length) {
|
|
143084
|
+
data = identifyColumnsArcgisrest(data, excludedColumns);
|
|
142990
143085
|
cb(null, {
|
|
142991
143086
|
dataset: visibleLayer.uid,
|
|
142992
143087
|
layerName: visibleLayer.displayName,
|
|
@@ -143094,6 +143189,10 @@ var VectorListener = {
|
|
|
143094
143189
|
var mapLayer = lyr.mapLayer;
|
|
143095
143190
|
var outFeatures = [];
|
|
143096
143191
|
var src = mapLayer.getSource();
|
|
143192
|
+
var excludedColumns = store.selectIdentifyColumnsExclude();
|
|
143193
|
+
var identifyFields = lyr.identifyFields;
|
|
143194
|
+
var identifyRenameColums = lyr.identifyRenameColums;
|
|
143195
|
+
var identifyFormatColumns = lyr.identifyFormatColumns;
|
|
143097
143196
|
src.forEachFeatureIntersectingExtent(identifyExtent, function (f) {
|
|
143098
143197
|
var geoJsonFeature = geoJSON$2.writeFeatureObject(f, {
|
|
143099
143198
|
featureProjection: "EPSG:3857",
|
|
@@ -143101,6 +143200,20 @@ var VectorListener = {
|
|
|
143101
143200
|
});
|
|
143102
143201
|
if (!booleanDisjoint(identifyFeature, geoJsonFeature)) outFeatures.push(geoJsonFeature);
|
|
143103
143202
|
});
|
|
143203
|
+
outFeatures = identifyExcludeColumnsArcgisvector(outFeatures, excludedColumns);
|
|
143204
|
+
|
|
143205
|
+
if (identifyFields) {
|
|
143206
|
+
outFeatures = identifyIncludeColumnsArcgisvector(outFeatures, identifyFields);
|
|
143207
|
+
}
|
|
143208
|
+
|
|
143209
|
+
if (identifyRenameColums) {
|
|
143210
|
+
outFeatures = identifyRenameColumnsArcgisvector(outFeatures, identifyRenameColums);
|
|
143211
|
+
}
|
|
143212
|
+
|
|
143213
|
+
if (identifyFormatColumns) {
|
|
143214
|
+
outFeatures = identifyFormatColumnsArcgisvector(outFeatures, identifyFormatColumns);
|
|
143215
|
+
}
|
|
143216
|
+
|
|
143104
143217
|
out.push({
|
|
143105
143218
|
dataset: lyr.uid,
|
|
143106
143219
|
layerName: lyr.displayName,
|
|
@@ -162782,6 +162895,7 @@ var bundle$e = {
|
|
|
162782
162895
|
if (!booleanDisjoint(identifyFeature, geoJsonFeature)) outFeatures.push(geoJsonFeature);
|
|
162783
162896
|
});
|
|
162784
162897
|
outFeatures = identifyColumnsArcgisvector(outFeatures, excludedColumns); //Column Filtering
|
|
162898
|
+
//Fix bug below only acting on layer 0
|
|
162785
162899
|
|
|
162786
162900
|
if (layers[0].identifyFields) {
|
|
162787
162901
|
outFeatures.forEach(function (feature) {
|
package/lib/prod.js
CHANGED
|
@@ -106481,7 +106481,7 @@ var config = {
|
|
|
106481
106481
|
};
|
|
106482
106482
|
|
|
106483
106483
|
var name = "@corpsmap/corpsmap";
|
|
106484
|
-
var version$1 = "3.2.
|
|
106484
|
+
var version$1 = "3.2.23";
|
|
106485
106485
|
var description = "CorpsMap as React Components";
|
|
106486
106486
|
var main = "index.js";
|
|
106487
106487
|
var scripts = {
|
|
@@ -132777,15 +132777,13 @@ var formatArcgisVector = function formatArcgisVector(results) {
|
|
|
132777
132777
|
if (result) {
|
|
132778
132778
|
feat.properties[key] = "<a href=\"".concat(value, "\" target=\"_new\" > ").concat(value, " </a>");
|
|
132779
132779
|
} // Format UNIX Date
|
|
132780
|
+
// if ((key === "fromdate" || key === "todate" || key === "referencedate") && Number.isInteger(feat.properties[key])) {
|
|
132781
|
+
// const unixTimestamp = feat.properties[key];
|
|
132782
|
+
// const milliseconds = unixTimestamp // * 1000 in some cases.
|
|
132783
|
+
// const dateObject = new Date(milliseconds);
|
|
132784
|
+
// feat.properties[key] = dateObject.toLocaleString();
|
|
132785
|
+
// }
|
|
132780
132786
|
|
|
132781
|
-
|
|
132782
|
-
if ((key === "fromdate" || key === "todate" || key === "referencedate") && Number.isInteger(feat.properties[key])) {
|
|
132783
|
-
var unixTimestamp = feat.properties[key];
|
|
132784
|
-
var milliseconds = unixTimestamp; // * 1000 in some cases.
|
|
132785
|
-
|
|
132786
|
-
var dateObject = new Date(milliseconds);
|
|
132787
|
-
feat.properties[key] = dateObject.toLocaleString();
|
|
132788
|
-
}
|
|
132789
132787
|
}
|
|
132790
132788
|
});
|
|
132791
132789
|
return results;
|
|
@@ -132804,7 +132802,7 @@ var identifyColumnsArcgisrest = function identifyColumnsArcgisrest(data, exclude
|
|
|
132804
132802
|
return data;
|
|
132805
132803
|
};
|
|
132806
132804
|
|
|
132807
|
-
var
|
|
132805
|
+
var identifyExcludeColumnsArcgisvector = function identifyExcludeColumnsArcgisvector(data, excludedColumns) {
|
|
132808
132806
|
data.forEach(function (feature) {
|
|
132809
132807
|
if (feature.properties) {
|
|
132810
132808
|
excludedColumns.forEach(function (column) {
|
|
@@ -132817,6 +132815,101 @@ var identifyColumnsArcgisvector = function identifyColumnsArcgisvector(data, exc
|
|
|
132817
132815
|
return data;
|
|
132818
132816
|
};
|
|
132819
132817
|
|
|
132818
|
+
var identifyIncludeColumnsArcgisvector = function identifyIncludeColumnsArcgisvector(data, identifyFields) {
|
|
132819
|
+
data.forEach(function (feature) {
|
|
132820
|
+
console.log(feature, feature.properties);
|
|
132821
|
+
|
|
132822
|
+
if (feature.properties) {
|
|
132823
|
+
var _loop = function _loop() {
|
|
132824
|
+
var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i3], 2),
|
|
132825
|
+
key = _Object$entries3$_i[0],
|
|
132826
|
+
value = _Object$entries3$_i[1];
|
|
132827
|
+
|
|
132828
|
+
var reducedProperties = {};
|
|
132829
|
+
identifyFields.forEach(function (property) {
|
|
132830
|
+
if (feature.properties[property]) {
|
|
132831
|
+
reducedProperties[property] = feature.properties[property];
|
|
132832
|
+
}
|
|
132833
|
+
});
|
|
132834
|
+
feature.properties = reducedProperties;
|
|
132835
|
+
};
|
|
132836
|
+
|
|
132837
|
+
for (var _i3 = 0, _Object$entries3 = Object.entries(feature.properties); _i3 < _Object$entries3.length; _i3++) {
|
|
132838
|
+
_loop();
|
|
132839
|
+
}
|
|
132840
|
+
}
|
|
132841
|
+
});
|
|
132842
|
+
return data;
|
|
132843
|
+
};
|
|
132844
|
+
|
|
132845
|
+
var identifyRenameColumnsArcgisvector = function identifyRenameColumnsArcgisvector(data, identifyRenameColums) {
|
|
132846
|
+
data.forEach(function (feature) {
|
|
132847
|
+
if (feature.properties) {
|
|
132848
|
+
var wkData = {};
|
|
132849
|
+
|
|
132850
|
+
for (var _i4 = 0, _Object$entries4 = Object.entries(feature.properties); _i4 < _Object$entries4.length; _i4++) {
|
|
132851
|
+
var _Object$entries4$_i = _slicedToArray(_Object$entries4[_i4], 2),
|
|
132852
|
+
featureKey = _Object$entries4$_i[0],
|
|
132853
|
+
featureValue = _Object$entries4$_i[1];
|
|
132854
|
+
|
|
132855
|
+
for (var _i5 = 0, _Object$entries5 = Object.entries(identifyRenameColums); _i5 < _Object$entries5.length; _i5++) {
|
|
132856
|
+
var _Object$entries5$_i = _slicedToArray(_Object$entries5[_i5], 2),
|
|
132857
|
+
key = _Object$entries5$_i[0],
|
|
132858
|
+
value = _Object$entries5$_i[1];
|
|
132859
|
+
|
|
132860
|
+
if (featureKey === key) {
|
|
132861
|
+
// feature.properties[value] = feature.properties[featureKey];
|
|
132862
|
+
wkData[value] = feature.properties[featureKey];
|
|
132863
|
+
delete feature.properties[featureKey];
|
|
132864
|
+
}
|
|
132865
|
+
}
|
|
132866
|
+
}
|
|
132867
|
+
|
|
132868
|
+
feature.properties = Object.assign(wkData, feature.properties);
|
|
132869
|
+
}
|
|
132870
|
+
});
|
|
132871
|
+
return data;
|
|
132872
|
+
};
|
|
132873
|
+
|
|
132874
|
+
var identifyFormatColumnsArcgisvector = function identifyFormatColumnsArcgisvector(data, identifyFormatColumns) {
|
|
132875
|
+
data.forEach(function (feature) {
|
|
132876
|
+
if (feature.properties) {
|
|
132877
|
+
for (var _i6 = 0, _Object$entries6 = Object.entries(identifyFormatColumns); _i6 < _Object$entries6.length; _i6++) {
|
|
132878
|
+
var _Object$entries6$_i = _slicedToArray(_Object$entries6[_i6], 2),
|
|
132879
|
+
key = _Object$entries6$_i[0],
|
|
132880
|
+
value = _Object$entries6$_i[1];
|
|
132881
|
+
|
|
132882
|
+
console.log(key, value);
|
|
132883
|
+
|
|
132884
|
+
if (feature.properties.hasOwnProperty(key)) {
|
|
132885
|
+
feature.properties[key] = formatColumns(feature.properties[key], value);
|
|
132886
|
+
}
|
|
132887
|
+
}
|
|
132888
|
+
}
|
|
132889
|
+
});
|
|
132890
|
+
return data;
|
|
132891
|
+
};
|
|
132892
|
+
|
|
132893
|
+
var formatColumns = function formatColumns(value, formatType) {
|
|
132894
|
+
if (formatType === "PERCENT") {
|
|
132895
|
+
value = (value * 100).toFixed(0) + '%';
|
|
132896
|
+
}
|
|
132897
|
+
|
|
132898
|
+
if (formatType === "BOOLEAN") {
|
|
132899
|
+
value = value === 0 ? "No" : "Yes";
|
|
132900
|
+
}
|
|
132901
|
+
|
|
132902
|
+
if (formatType === "UNIXDATE") {
|
|
132903
|
+
var unixTimestamp = value;
|
|
132904
|
+
var milliseconds = unixTimestamp; // * 1000 in some cases.
|
|
132905
|
+
|
|
132906
|
+
var dateObject = new Date(milliseconds);
|
|
132907
|
+
value = dateObject.toLocaleString();
|
|
132908
|
+
}
|
|
132909
|
+
|
|
132910
|
+
return value;
|
|
132911
|
+
};
|
|
132912
|
+
|
|
132820
132913
|
function formatUrl(options) {
|
|
132821
132914
|
var url = "".concat(options.root, "/identify?");
|
|
132822
132915
|
var params = [];
|
|
@@ -142862,7 +142955,8 @@ var ArcGisListener = {
|
|
|
142862
142955
|
var visibleLayers = store.selectVisibleLayers();
|
|
142863
142956
|
if (!visibleLayers.length) return callback(null, []);
|
|
142864
142957
|
var queries = [];
|
|
142865
|
-
var identifyFeature = store.doSetIdentifyFeature();
|
|
142958
|
+
var identifyFeature = store.doSetIdentifyFeature();
|
|
142959
|
+
var excludedColumns = store.selectIdentifyColumnsExclude(); //https://developers.arcgis.com/rest/services-reference/enterprise/identify-map-service-.htm
|
|
142866
142960
|
|
|
142867
142961
|
var params = {
|
|
142868
142962
|
sr: 4326,
|
|
@@ -142901,6 +142995,7 @@ var ArcGisListener = {
|
|
|
142901
142995
|
var data = JSON.parse(body);
|
|
142902
142996
|
|
|
142903
142997
|
if (data.results.length) {
|
|
142998
|
+
data = identifyColumnsArcgisrest(data, excludedColumns);
|
|
142904
142999
|
cb(null, {
|
|
142905
143000
|
dataset: visibleLayer.uid,
|
|
142906
143001
|
layerName: visibleLayer.displayName,
|
|
@@ -143008,6 +143103,10 @@ var VectorListener = {
|
|
|
143008
143103
|
var mapLayer = lyr.mapLayer;
|
|
143009
143104
|
var outFeatures = [];
|
|
143010
143105
|
var src = mapLayer.getSource();
|
|
143106
|
+
var excludedColumns = store.selectIdentifyColumnsExclude();
|
|
143107
|
+
var identifyFields = lyr.identifyFields;
|
|
143108
|
+
var identifyRenameColums = lyr.identifyRenameColums;
|
|
143109
|
+
var identifyFormatColumns = lyr.identifyFormatColumns;
|
|
143011
143110
|
src.forEachFeatureIntersectingExtent(identifyExtent, function (f) {
|
|
143012
143111
|
var geoJsonFeature = geoJSON$2.writeFeatureObject(f, {
|
|
143013
143112
|
featureProjection: "EPSG:3857",
|
|
@@ -143015,6 +143114,20 @@ var VectorListener = {
|
|
|
143015
143114
|
});
|
|
143016
143115
|
if (!booleanDisjoint(identifyFeature, geoJsonFeature)) outFeatures.push(geoJsonFeature);
|
|
143017
143116
|
});
|
|
143117
|
+
outFeatures = identifyExcludeColumnsArcgisvector(outFeatures, excludedColumns);
|
|
143118
|
+
|
|
143119
|
+
if (identifyFields) {
|
|
143120
|
+
outFeatures = identifyIncludeColumnsArcgisvector(outFeatures, identifyFields);
|
|
143121
|
+
}
|
|
143122
|
+
|
|
143123
|
+
if (identifyRenameColums) {
|
|
143124
|
+
outFeatures = identifyRenameColumnsArcgisvector(outFeatures, identifyRenameColums);
|
|
143125
|
+
}
|
|
143126
|
+
|
|
143127
|
+
if (identifyFormatColumns) {
|
|
143128
|
+
outFeatures = identifyFormatColumnsArcgisvector(outFeatures, identifyFormatColumns);
|
|
143129
|
+
}
|
|
143130
|
+
|
|
143018
143131
|
out.push({
|
|
143019
143132
|
dataset: lyr.uid,
|
|
143020
143133
|
layerName: lyr.displayName,
|
|
@@ -162696,6 +162809,7 @@ var bundle$e = {
|
|
|
162696
162809
|
if (!booleanDisjoint(identifyFeature, geoJsonFeature)) outFeatures.push(geoJsonFeature);
|
|
162697
162810
|
});
|
|
162698
162811
|
outFeatures = identifyColumnsArcgisvector(outFeatures, excludedColumns); //Column Filtering
|
|
162812
|
+
//Fix bug below only acting on layer 0
|
|
162699
162813
|
|
|
162700
162814
|
if (layers[0].identifyFields) {
|
|
162701
162815
|
outFeatures.forEach(function (feature) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import async from "async";
|
|
2
2
|
import EsriJSON from "ol/format/EsriJSON";
|
|
3
|
-
import { formatArcgisrest } from "../../../openlayers-utils/format-utilities";
|
|
3
|
+
import { formatArcgisrest, identifyColumnsArcgisrest } from "../../../openlayers-utils/format-utilities";
|
|
4
4
|
const esrijsonFormat = new EsriJSON();
|
|
5
5
|
|
|
6
6
|
function formatUrl(options) {
|
|
@@ -52,6 +52,7 @@ export default {
|
|
|
52
52
|
const queries = [];
|
|
53
53
|
const featureType = "Polygon";
|
|
54
54
|
const identifyFeature = store.doSetIdentifyFeature();
|
|
55
|
+
let excludedColumns = store.selectIdentifyColumnsExclude();
|
|
55
56
|
|
|
56
57
|
//https://developers.arcgis.com/rest/services-reference/enterprise/identify-map-service-.htm
|
|
57
58
|
const params = {
|
|
@@ -69,7 +70,7 @@ export default {
|
|
|
69
70
|
})
|
|
70
71
|
),
|
|
71
72
|
};
|
|
72
|
-
|
|
73
|
+
|
|
73
74
|
visibleLayers.forEach((visibleLayer) => {
|
|
74
75
|
if (
|
|
75
76
|
visibleLayer.identifyType &&
|
|
@@ -91,9 +92,11 @@ export default {
|
|
|
91
92
|
});
|
|
92
93
|
} else {
|
|
93
94
|
try {
|
|
94
|
-
|
|
95
|
+
let data = JSON.parse(body);
|
|
95
96
|
|
|
96
97
|
if (data.results.length) {
|
|
98
|
+
data = identifyColumnsArcgisrest(data, excludedColumns)
|
|
99
|
+
|
|
97
100
|
cb(null, {
|
|
98
101
|
dataset: visibleLayer.uid,
|
|
99
102
|
layerName: visibleLayer.displayName,
|
|
@@ -129,6 +132,7 @@ export default {
|
|
|
129
132
|
}
|
|
130
133
|
} catch (err) {
|
|
131
134
|
console.log(err);
|
|
135
|
+
|
|
132
136
|
cb(null, {
|
|
133
137
|
dataset: visibleLayer.uid,
|
|
134
138
|
layerName: visibleLayer.displayName,
|
|
@@ -5,7 +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 { formatArcgisVector } from "../../../openlayers-utils/format-utilities";
|
|
8
|
+
import { formatArcgisVector, identifyExcludeColumnsArcgisvector, identifyIncludeColumnsArcgisvector, identifyRenameColumnsArcgisvector, identifyFormatColumnsArcgisvector } from "../../../openlayers-utils/format-utilities";
|
|
9
9
|
|
|
10
10
|
const geoJSON = new GeoJSON();
|
|
11
11
|
|
|
@@ -55,8 +55,12 @@ export default {
|
|
|
55
55
|
layers.forEach((lyr) => {
|
|
56
56
|
if (lyr.identifyType && lyr.identifyType === "arcgisvector") {
|
|
57
57
|
const { mapLayer } = lyr;
|
|
58
|
-
|
|
58
|
+
let outFeatures = [];
|
|
59
59
|
const src = mapLayer.getSource();
|
|
60
|
+
let excludedColumns = store.selectIdentifyColumnsExclude();
|
|
61
|
+
const identifyFields = lyr.identifyFields;
|
|
62
|
+
const identifyRenameColums = lyr.identifyRenameColums;
|
|
63
|
+
const identifyFormatColumns = lyr.identifyFormatColumns;
|
|
60
64
|
src.forEachFeatureIntersectingExtent(identifyExtent, (f) => {
|
|
61
65
|
const geoJsonFeature = geoJSON.writeFeatureObject(f, {
|
|
62
66
|
featureProjection: "EPSG:3857",
|
|
@@ -65,6 +69,20 @@ export default {
|
|
|
65
69
|
if (!disjoint(identifyFeature, geoJsonFeature))
|
|
66
70
|
outFeatures.push(geoJsonFeature);
|
|
67
71
|
});
|
|
72
|
+
outFeatures = identifyExcludeColumnsArcgisvector(outFeatures, excludedColumns);
|
|
73
|
+
|
|
74
|
+
if (identifyFields) {
|
|
75
|
+
outFeatures = identifyIncludeColumnsArcgisvector(outFeatures, identifyFields);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (identifyRenameColums) {
|
|
79
|
+
outFeatures = identifyRenameColumnsArcgisvector(outFeatures, identifyRenameColums);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (identifyFormatColumns) {
|
|
83
|
+
outFeatures = identifyFormatColumnsArcgisvector(outFeatures, identifyFormatColumns)
|
|
84
|
+
}
|
|
85
|
+
|
|
68
86
|
out.push({
|
|
69
87
|
dataset: lyr.uid,
|
|
70
88
|
layerName: lyr.displayName,
|
|
@@ -46,7 +46,7 @@ export default {
|
|
|
46
46
|
({ store, anonGet }) => {
|
|
47
47
|
const coords = store.selectIdentifyCoordinates();
|
|
48
48
|
const visibleLayers = store.selectVisibleLayers();
|
|
49
|
-
let excludedColumns = store.selectIdentifyColumnsExclude()
|
|
49
|
+
let excludedColumns = store.selectIdentifyColumnsExclude();
|
|
50
50
|
let featureType = "Point";
|
|
51
51
|
|
|
52
52
|
if (!visibleLayers.length) return callback(null, []);
|
|
@@ -95,6 +95,7 @@ export default {
|
|
|
95
95
|
let data = JSON.parse(body);
|
|
96
96
|
data = identifyColumnsArcgisrest(data, excludedColumns)
|
|
97
97
|
//Column Filtering
|
|
98
|
+
|
|
98
99
|
if (visibleLayer.identifyFields) {
|
|
99
100
|
data.results.forEach((result) => {
|
|
100
101
|
if(result.attributes){
|
|
@@ -5,7 +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 { formatArcgisVector,
|
|
8
|
+
import { formatArcgisVector, identifyExcludeColumnsArcgisvector } from "../../openlayers-utils/format-utilities";
|
|
9
9
|
|
|
10
10
|
const geoJSON = new GeoJSON();
|
|
11
11
|
|
|
@@ -80,6 +80,7 @@ export default {
|
|
|
80
80
|
});
|
|
81
81
|
outFeatures = identifyColumnsArcgisvector(outFeatures, excludedColumns)
|
|
82
82
|
//Column Filtering
|
|
83
|
+
//Fix bug below only acting on layer 0
|
|
83
84
|
if (layers[0].identifyFields) {
|
|
84
85
|
outFeatures.forEach((feature) => {
|
|
85
86
|
if(feature.properties){
|
|
@@ -26,12 +26,13 @@ const formatArcgisVector = function (results) {
|
|
|
26
26
|
] = `<a href="${value}" target="_new" > ${value} </a>`;
|
|
27
27
|
}
|
|
28
28
|
// Format UNIX Date
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
|
|
30
|
+
// if ((key === "fromdate" || key === "todate" || key === "referencedate") && Number.isInteger(feat.properties[key])) {
|
|
31
|
+
// const unixTimestamp = feat.properties[key];
|
|
32
|
+
// const milliseconds = unixTimestamp // * 1000 in some cases.
|
|
33
|
+
// const dateObject = new Date(milliseconds);
|
|
34
|
+
// feat.properties[key] = dateObject.toLocaleString();
|
|
35
|
+
// }
|
|
35
36
|
|
|
36
37
|
}
|
|
37
38
|
});
|
|
@@ -45,12 +46,12 @@ const identifyColumnsArcgisrest = function (data, excludedColumns) {
|
|
|
45
46
|
delete result.attributes[column];
|
|
46
47
|
});
|
|
47
48
|
}
|
|
48
|
-
return result.attributes
|
|
49
|
+
return result.attributes;
|
|
49
50
|
});
|
|
50
51
|
return data;
|
|
51
52
|
};
|
|
52
53
|
|
|
53
|
-
const
|
|
54
|
+
const identifyExcludeColumnsArcgisvector = function (data, excludedColumns) {
|
|
54
55
|
data.forEach((feature) => {
|
|
55
56
|
if(feature.properties){
|
|
56
57
|
excludedColumns.forEach((column) => {
|
|
@@ -63,5 +64,76 @@ const identifyColumnsArcgisvector = function (data, excludedColumns) {
|
|
|
63
64
|
return data;
|
|
64
65
|
};
|
|
65
66
|
|
|
67
|
+
const identifyIncludeColumnsArcgisvector = function (data, identifyFields) {
|
|
68
|
+
data.forEach((feature) => {
|
|
69
|
+
console.log(feature, feature.properties)
|
|
70
|
+
if(feature.properties){
|
|
71
|
+
for (const [key, value] of Object.entries(feature.properties)) {
|
|
72
|
+
let reducedProperties = {};
|
|
73
|
+
identifyFields.forEach((property) => {
|
|
74
|
+
if (feature.properties[property]) {
|
|
75
|
+
reducedProperties[property] =
|
|
76
|
+
feature.properties[property];
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
feature.properties = reducedProperties;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
return data;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const identifyRenameColumnsArcgisvector = function (data, identifyRenameColums) {
|
|
88
|
+
|
|
89
|
+
data.forEach((feature) => {
|
|
90
|
+
if(feature.properties){
|
|
91
|
+
let wkData = {};
|
|
92
|
+
for (const [featureKey, featureValue] of Object.entries(feature.properties)) {
|
|
93
|
+
for (const [key, value] of Object.entries(identifyRenameColums)){
|
|
94
|
+
if (featureKey === key) {
|
|
95
|
+
// feature.properties[value] = feature.properties[featureKey];
|
|
96
|
+
wkData[value] = feature.properties[featureKey];
|
|
97
|
+
delete feature.properties[featureKey];
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
feature.properties = Object.assign(wkData, feature.properties)
|
|
102
|
+
}
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
return data;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const identifyFormatColumnsArcgisvector = function (data, identifyFormatColumns) {
|
|
109
|
+
data.forEach((feature) => {
|
|
110
|
+
if(feature.properties){
|
|
111
|
+
for (const [key, value] of Object.entries(identifyFormatColumns)){
|
|
112
|
+
console.log(key, value);
|
|
113
|
+
if(feature.properties.hasOwnProperty(key)){
|
|
114
|
+
feature.properties[key] = formatColumns(feature.properties[key], value)
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
return data;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const formatColumns = function (value, formatType) {
|
|
124
|
+
if (formatType === "PERCENT") {
|
|
125
|
+
value = (value * 100).toFixed(0) + '%'
|
|
126
|
+
}
|
|
127
|
+
if (formatType === "BOOLEAN") {
|
|
128
|
+
value = value === 0 ? "No" : "Yes"
|
|
129
|
+
}
|
|
130
|
+
if (formatType === "UNIXDATE") {
|
|
131
|
+
const unixTimestamp = value;
|
|
132
|
+
const milliseconds = unixTimestamp // * 1000 in some cases.
|
|
133
|
+
const dateObject = new Date(milliseconds);
|
|
134
|
+
value = dateObject.toLocaleString();
|
|
135
|
+
}
|
|
136
|
+
return value;
|
|
137
|
+
};
|
|
66
138
|
|
|
67
|
-
export { formatArcgisVector, formatArcgisrest, identifyColumnsArcgisrest,
|
|
139
|
+
export { formatArcgisVector, formatArcgisrest, identifyColumnsArcgisrest, identifyExcludeColumnsArcgisvector, identifyIncludeColumnsArcgisvector, identifyRenameColumnsArcgisvector, identifyFormatColumnsArcgisvector };
|