@redus/georedus-ui 0.3.2 → 0.5.0
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/CHANGELOG.md +18 -0
- package/dist/GeoReDUS/useMapStyle.d.ts +1 -0
- package/dist/ViewControl/ViewControl.d.ts +1 -2
- package/dist/main.js +561 -351
- package/dist/viewSpecs/presets/cem_censo_2010_2022/index.d.ts +1 -0
- package/dist/viewSpecs/util/{BASE_MAP_LAYERS.d.ts → VEGETATION_AND_WATER_OVERLAY_LAYERS.d.ts} +1 -1
- package/dist/viewSpecs/util/colorSchemes.d.ts +1 -0
- package/dist/viewSpecs/util/index.d.ts +1 -0
- package/dist/viewSpecs/util/influenceArea.d.ts +111 -0
- package/package.json +3 -3
- package/dist/viewSpecs/presets/cem_saude_2024/numerical_choropleth.d.ts +0 -10
package/dist/main.js
CHANGED
|
@@ -11,29 +11,29 @@ import { __makeTemplateObject, __assign, __spreadArray, __awaiter, __generator }
|
|
|
11
11
|
import remarkMath from 'remark-math';
|
|
12
12
|
import rehypeKatex from 'rehype-katex';
|
|
13
13
|
import 'katex/dist/katex.min.css';
|
|
14
|
-
import { isPlainObject, pick, omit, set,
|
|
14
|
+
import { isPlainObject, get, pick, omit, set, uniqBy, groupBy, uniq } from 'lodash';
|
|
15
15
|
import { useDebounce } from 'react-use';
|
|
16
16
|
import { createDialogSystem, DIALOGS } from '@orioro/react-dialogs';
|
|
17
17
|
import { CsvImportDialog } from '@orioro/react-csv';
|
|
18
18
|
import Highlighter from 'react-highlight-words';
|
|
19
19
|
import { makeSortableMultiList } from '@orioro/react-sortable';
|
|
20
|
-
import { makeSyncedMaps, LayeredMap, HoverTooltip, ControlContainer, InspectControl, MapWindow, TerrainControl, fitGeometry } from '@orioro/react-maplibre-util';
|
|
20
|
+
import { fmtLayerAbsoluteId, makeSyncedMaps, LayeredMap, HoverTooltip, ControlContainer, InspectControl, MapWindow, TerrainControl, fitGeometry } from '@orioro/react-maplibre-util';
|
|
21
21
|
import { Legend } from '@orioro/react-chart-util';
|
|
22
22
|
import 'maplibre-gl/dist/maplibre-gl.css';
|
|
23
23
|
import { useQueries, useQuery } from '@tanstack/react-query';
|
|
24
|
-
import { AttributionControl, GeolocateControl, FullscreenControl, NavigationControl, ScaleControl } from 'react-map-gl/maplibre';
|
|
24
|
+
import { AttributionControl, GeolocateControl, FullscreenControl, NavigationControl, ScaleControl, useMap } from 'react-map-gl/maplibre';
|
|
25
25
|
import { slugify, dataJoin } from '@orioro/util';
|
|
26
|
-
import { schemeTableau10, schemeSet3, schemeSet2, schemeSet1, schemePastel2, schemePastel1, schemePaired, schemeObservable10, schemeDark2, schemeAccent, schemeCategory10, schemeSpectral, schemeRdYlGn, schemeRdYlBu, schemeRdGy, schemeRdBu, schemePuOr, schemePiYG, schemePRGn, schemeBrBG, schemeYlOrRd, schemeYlOrBr, schemeYlGn, schemeYlGnBu, schemeRdPu, schemePuRd, schemePuBu, schemePuBuGn, schemeOrRd, schemeGnBu, schemeBuPu, schemeBuGn, schemeReds, schemePurples, schemeOranges, schemeGreys, schemeGreens, schemeBlues } from 'd3-scale-chromatic';
|
|
27
26
|
import { makeResolve, $$literal, withExpressionResolvers, expressions, ALL_EXPR, fetchExpr, resolve, resolveAsync } from '@orioro/resolve';
|
|
27
|
+
import { schemeTableau10, schemeSet3, schemeSet2, schemeSet1, schemePastel2, schemePastel1, schemePaired, schemeObservable10, schemeDark2, schemeAccent, schemeCategory10, schemeSpectral, schemeRdYlGn, schemeRdYlBu, schemeRdGy, schemeRdBu, schemePuOr, schemePiYG, schemePRGn, schemeBrBG, schemeYlOrRd, schemeYlOrBr, schemeYlGn, schemeYlGnBu, schemeRdPu, schemePuRd, schemePuBu, schemePuBuGn, schemeOrRd, schemeGnBu, schemeBuPu, schemeBuGn, schemeReds, schemePurples, schemeOranges, schemeGreys, schemeGreens, schemeBlues } from 'd3-scale-chromatic';
|
|
28
28
|
import { saveAs } from 'file-saver';
|
|
29
29
|
import initGdalJs from 'gdal3.js';
|
|
30
30
|
import queryString from 'query-string';
|
|
31
31
|
import { wrap } from 'comlink';
|
|
32
|
+
import { get as get$1 } from '@orioro/get';
|
|
32
33
|
import { validate } from '@orioro/validate';
|
|
33
34
|
import { buffer } from '@turf/turf';
|
|
34
35
|
import { csvParse } from 'd3-dsv';
|
|
35
36
|
import { strAutoCast } from '@orioro/cast';
|
|
36
|
-
import { get as get$1 } from '@orioro/get';
|
|
37
37
|
|
|
38
38
|
function _arrayLikeToArray(r, a) {
|
|
39
39
|
(null == a || a > r.length) && (a = r.length);
|
|
@@ -71,6 +71,54 @@ function _asyncToGenerator(n) {
|
|
|
71
71
|
});
|
|
72
72
|
};
|
|
73
73
|
}
|
|
74
|
+
function _createForOfIteratorHelper(r, e) {
|
|
75
|
+
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
76
|
+
if (!t) {
|
|
77
|
+
if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e) {
|
|
78
|
+
t && (r = t);
|
|
79
|
+
var n = 0,
|
|
80
|
+
F = function () {};
|
|
81
|
+
return {
|
|
82
|
+
s: F,
|
|
83
|
+
n: function () {
|
|
84
|
+
return n >= r.length ? {
|
|
85
|
+
done: true
|
|
86
|
+
} : {
|
|
87
|
+
done: false,
|
|
88
|
+
value: r[n++]
|
|
89
|
+
};
|
|
90
|
+
},
|
|
91
|
+
e: function (r) {
|
|
92
|
+
throw r;
|
|
93
|
+
},
|
|
94
|
+
f: F
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
98
|
+
}
|
|
99
|
+
var o,
|
|
100
|
+
a = true,
|
|
101
|
+
u = false;
|
|
102
|
+
return {
|
|
103
|
+
s: function () {
|
|
104
|
+
t = t.call(r);
|
|
105
|
+
},
|
|
106
|
+
n: function () {
|
|
107
|
+
var r = t.next();
|
|
108
|
+
return a = r.done, r;
|
|
109
|
+
},
|
|
110
|
+
e: function (r) {
|
|
111
|
+
u = true, o = r;
|
|
112
|
+
},
|
|
113
|
+
f: function () {
|
|
114
|
+
try {
|
|
115
|
+
a || null == t.return || t.return();
|
|
116
|
+
} finally {
|
|
117
|
+
if (u) throw o;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
}
|
|
74
122
|
function _defineProperty(e, r, t) {
|
|
75
123
|
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
76
124
|
value: t,
|
|
@@ -749,7 +797,7 @@ function ViewConfTabs(_ref) {
|
|
|
749
797
|
}, "Visualiza\xE7\xE3o habilitada"));
|
|
750
798
|
}
|
|
751
799
|
|
|
752
|
-
var _excluded$
|
|
800
|
+
var _excluded$4 = ["textSearch", "content", "maxLines"];
|
|
753
801
|
var _templateObject$3, _templateObject2$2;
|
|
754
802
|
var Container = styled(Box)(_templateObject$3 || (_templateObject$3 = _taggedTemplateLiteral(["\n --view-control-base-padding: 12px;\n box-shadow:\n rgba(0, 0, 0, 0.12) 0px 1px 3px,\n rgba(0, 0, 0, 0.24) 0px 1px 2px;\n\n border-radius: 2px;\n background-color: var(--redus-bege, white);\n // background-color: var(--accent-4, white);\n"])));
|
|
755
803
|
var Summary = styled.div(_templateObject2$2 || (_templateObject2$2 = _taggedTemplateLiteral(["\n // background-color: var(--redus-bege, white);\n background-color: ", ";\n padding: 0;\n\n transition: background-color 0.1s ease-out;\n\n display: flex;\n border: none;\n text-align: left;\n width: 100%;\n\n cursor: pointer;\n\n &:hover {\n // background-color: color-mix(in srgb, var(--redus-bege) 80%, white);\n background-color: ", ";\n }\n\n &:active {\n filter: brightness(96%);\n }\n"])), function (_ref) {
|
|
@@ -777,7 +825,7 @@ function HeadingWithTooltipAndEllipsis(_ref7) {
|
|
|
777
825
|
content = _ref7.content,
|
|
778
826
|
_ref7$maxLines = _ref7.maxLines,
|
|
779
827
|
maxLines = _ref7$maxLines === void 0 ? 2 : _ref7$maxLines,
|
|
780
|
-
props = _objectWithoutProperties(_ref7, _excluded$
|
|
828
|
+
props = _objectWithoutProperties(_ref7, _excluded$4);
|
|
781
829
|
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
782
830
|
content: content
|
|
783
831
|
}, /*#__PURE__*/React.createElement(Heading, _extends({
|
|
@@ -816,7 +864,7 @@ function ViewControl(_ref8) {
|
|
|
816
864
|
var toggleView = useCallback(function () {
|
|
817
865
|
return active ? deactivateView() : setView();
|
|
818
866
|
}, [active, deactivateView, setView]);
|
|
819
|
-
return /*#__PURE__*/React.createElement(Collapsible.Root, {
|
|
867
|
+
return viewSpec && /*#__PURE__*/React.createElement(Collapsible.Root, {
|
|
820
868
|
open: configurable === true && active
|
|
821
869
|
}, /*#__PURE__*/React.createElement(Container, null, /*#__PURE__*/React.createElement(Summary, {
|
|
822
870
|
type: "button",
|
|
@@ -886,7 +934,7 @@ function ViewControl(_ref8) {
|
|
|
886
934
|
|
|
887
935
|
var VIEW_TYPE_SURFACE_CHOROPLETH = 'surface_choropleth';
|
|
888
936
|
|
|
889
|
-
var _excluded$
|
|
937
|
+
var _excluded$3 = ["viewSpecs", "viewConfState", "resolvedViews", "onSetView", "onDeactivateView", "style"];
|
|
890
938
|
var _templateObject$2, _templateObject2$1;
|
|
891
939
|
var STATIC_NODE_ICONS = {
|
|
892
940
|
'populacao-e-domicilios': /*#__PURE__*/React.createElement(Icon, {
|
|
@@ -953,7 +1001,8 @@ function Item(_ref) {
|
|
|
953
1001
|
//
|
|
954
1002
|
viewConfState.layout.findIndex(function (list) {
|
|
955
1003
|
return list.items.every(function (item) {
|
|
956
|
-
|
|
1004
|
+
var _viewSpecsById$item$i;
|
|
1005
|
+
return ((_viewSpecsById$item$i = viewSpecsById[item.id]) === null || _viewSpecsById$item$i === void 0 ? void 0 : _viewSpecsById$item$i.viewType) !== VIEW_TYPE_SURFACE_CHOROPLETH;
|
|
957
1006
|
});
|
|
958
1007
|
}) : 0;
|
|
959
1008
|
}
|
|
@@ -976,7 +1025,9 @@ function _countActiveViews(_ref2) {
|
|
|
976
1025
|
// Add final forward slash to ensure node id is understood as a dir
|
|
977
1026
|
var nodeDirPath = "".concat(nodeId, "/");
|
|
978
1027
|
return Object.keys(viewConfState.byId).filter(function (activeItemId) {
|
|
979
|
-
var
|
|
1028
|
+
var viewSpec = viewSpecsById[activeItemId];
|
|
1029
|
+
if (!viewSpec) return false;
|
|
1030
|
+
var activeItemPath = nodeIdFromPath(viewSpec.path + ' / ' + viewSpec.label);
|
|
980
1031
|
return activeItemPath.startsWith(nodeDirPath);
|
|
981
1032
|
}).length;
|
|
982
1033
|
}
|
|
@@ -1025,7 +1076,7 @@ function ViewMenu(_ref4) {
|
|
|
1025
1076
|
onSetView = _ref4.onSetView,
|
|
1026
1077
|
onDeactivateView = _ref4.onDeactivateView,
|
|
1027
1078
|
style = _ref4.style,
|
|
1028
|
-
props = _objectWithoutProperties(_ref4, _excluded$
|
|
1079
|
+
props = _objectWithoutProperties(_ref4, _excluded$3);
|
|
1029
1080
|
var viewSpecsById = useMemo(function () {
|
|
1030
1081
|
return Object.fromEntries(viewSpecs.map(function (spec) {
|
|
1031
1082
|
return [spec.id, spec];
|
|
@@ -1392,7 +1443,9 @@ function LeftPanel(_ref) {
|
|
|
1392
1443
|
flexGrow: 1,
|
|
1393
1444
|
position: 'relative'
|
|
1394
1445
|
}
|
|
1395
|
-
}, /*#__PURE__*/React.createElement(LoadingOverlay,
|
|
1446
|
+
}, /*#__PURE__*/React.createElement(LoadingOverlay, {
|
|
1447
|
+
message: null
|
|
1448
|
+
})), /*#__PURE__*/React.createElement(Flex, {
|
|
1396
1449
|
p: "2",
|
|
1397
1450
|
style: {
|
|
1398
1451
|
backgroundColor: 'white'
|
|
@@ -1569,12 +1622,12 @@ function ViewLayoutControl(_ref4) {
|
|
|
1569
1622
|
}));
|
|
1570
1623
|
}
|
|
1571
1624
|
|
|
1572
|
-
var _excluded$
|
|
1625
|
+
var _excluded$2 = ["viewSpecs", "viewConfState", "viewConfDispatch"];
|
|
1573
1626
|
function ViewLayoutPopover(_ref) {
|
|
1574
1627
|
var viewSpecs = _ref.viewSpecs,
|
|
1575
1628
|
viewConfState = _ref.viewConfState,
|
|
1576
1629
|
viewConfDispatch = _ref.viewConfDispatch,
|
|
1577
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
1630
|
+
props = _objectWithoutProperties(_ref, _excluded$2);
|
|
1578
1631
|
var activeViewCount = useMemo(function () {
|
|
1579
1632
|
return Object.keys(viewConfState.byId).length;
|
|
1580
1633
|
}, [viewConfState.byId]);
|
|
@@ -1611,7 +1664,7 @@ function ViewLayoutPopover(_ref) {
|
|
|
1611
1664
|
}))))));
|
|
1612
1665
|
}
|
|
1613
1666
|
|
|
1614
|
-
var
|
|
1667
|
+
var VEGETATION_AND_WATER_OVERLAY_LAYERS = [
|
|
1615
1668
|
// {
|
|
1616
1669
|
// "id": "Background",
|
|
1617
1670
|
// "type": "background",
|
|
@@ -3997,6 +4050,13 @@ var COLOR_SCHEMES = __assign(__assign(__assign(__assign(__assign({}, _objMap(D3_
|
|
|
3997
4050
|
scheme = _a[1];
|
|
3998
4051
|
return ["-".concat(id), _reverseByKScheme(scheme)];
|
|
3999
4052
|
}));
|
|
4053
|
+
function colorScheme(path) {
|
|
4054
|
+
var scheme = get(COLOR_SCHEMES, path);
|
|
4055
|
+
if (!scheme) {
|
|
4056
|
+
throw new Error("Could not find scheme at ".concat(path));
|
|
4057
|
+
}
|
|
4058
|
+
return scheme;
|
|
4059
|
+
}
|
|
4000
4060
|
|
|
4001
4061
|
//
|
|
4002
4062
|
// Formats the filter to be a compatible searchParams for fetching
|
|
@@ -4459,12 +4519,167 @@ function zoomSensitiveLinearSizes(_a) {
|
|
|
4459
4519
|
return ['step', ['zoom'], defaultSize, zoomBreakpoint, largerSize];
|
|
4460
4520
|
}
|
|
4461
4521
|
|
|
4462
|
-
|
|
4522
|
+
function influenceAreaConf(_a) {
|
|
4523
|
+
var _b = _a === void 0 ? {} : _a,
|
|
4524
|
+
_c = _b.defaultBufferSize,
|
|
4525
|
+
defaultBufferSize = _c === void 0 ? 200 : _c,
|
|
4526
|
+
_d = _b.maxBufferSize,
|
|
4527
|
+
maxBufferSize = _d === void 0 ? 2000 : _d,
|
|
4528
|
+
_e = _b.minBufferSize,
|
|
4529
|
+
minBufferSize = _e === void 0 ? 0 : _e,
|
|
4530
|
+
_f = _b.bufferSizeStep,
|
|
4531
|
+
bufferSizeStep = _f === void 0 ? 50 : _f;
|
|
4532
|
+
return {
|
|
4533
|
+
showInfluenceArea: {
|
|
4534
|
+
type: 'booleanCheckbox',
|
|
4535
|
+
label: 'Área de influência',
|
|
4536
|
+
description: 'Visualizar área de influência',
|
|
4537
|
+
defaultValue: true
|
|
4538
|
+
},
|
|
4539
|
+
influenceAreaRadius: {
|
|
4540
|
+
type: 'slider',
|
|
4541
|
+
inactive: resolve.literal(resolve.fn(function (context) {
|
|
4542
|
+
var _a;
|
|
4543
|
+
return !((_a = context.value) === null || _a === void 0 ? void 0 : _a.showInfluenceArea);
|
|
4544
|
+
})),
|
|
4545
|
+
label: resolve.literal(resolve.fn(function (context) {
|
|
4546
|
+
var _a;
|
|
4547
|
+
return "Raio de influ\xEAncia (".concat(((_a = context.value) === null || _a === void 0 ? void 0 : _a.influenceAreaRadius) || defaultBufferSize, "m)");
|
|
4548
|
+
})),
|
|
4549
|
+
helperText: 'Configure um raio de influência do equipamento',
|
|
4550
|
+
min: minBufferSize,
|
|
4551
|
+
max: maxBufferSize,
|
|
4552
|
+
step: bufferSizeStep,
|
|
4553
|
+
defaultValue: defaultBufferSize
|
|
4554
|
+
},
|
|
4555
|
+
dissolveOverlappingGeometries: {
|
|
4556
|
+
inactive: resolve.literal(resolve.fn(function (context) {
|
|
4557
|
+
var _a;
|
|
4558
|
+
return !((_a = context.value) === null || _a === void 0 ? void 0 : _a.showInfluenceArea);
|
|
4559
|
+
})),
|
|
4560
|
+
type: 'booleanCheckbox',
|
|
4561
|
+
label: 'Dissolver geometrias',
|
|
4562
|
+
description: 'Unir geometrias sobrepostas',
|
|
4563
|
+
defaultValue: false
|
|
4564
|
+
}
|
|
4565
|
+
};
|
|
4566
|
+
}
|
|
4567
|
+
function _defaultGetGeoJson(context) {
|
|
4568
|
+
return {
|
|
4569
|
+
type: 'FeatureCollection',
|
|
4570
|
+
features: context.rawData.map(function (entry) {
|
|
4571
|
+
return {
|
|
4572
|
+
type: 'Feature',
|
|
4573
|
+
geometry: entry.geom,
|
|
4574
|
+
properties: omit(entry, ['geom'])
|
|
4575
|
+
};
|
|
4576
|
+
})
|
|
4577
|
+
};
|
|
4578
|
+
}
|
|
4579
|
+
function influenceAreaMetadata(_a) {
|
|
4580
|
+
var _this = this;
|
|
4581
|
+
var _b = {} ,
|
|
4582
|
+
_c = _b.getGeoJson,
|
|
4583
|
+
getGeoJson = _c === void 0 ? _defaultGetGeoJson : _c,
|
|
4584
|
+
_d = _b.getConf,
|
|
4585
|
+
getConf = _d === void 0 ? function (context) {
|
|
4586
|
+
return get$1(context, 'view.conf.data') || {};
|
|
4587
|
+
} : _d;
|
|
4588
|
+
return {
|
|
4589
|
+
influenceArea: resolveAsync.fn(function (context) {
|
|
4590
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
4591
|
+
var _a, influenceAreaRadius, showInfluenceArea, dissolveOverlappingGeometries, geoJson, influenceArea;
|
|
4592
|
+
return __generator(this, function (_b) {
|
|
4593
|
+
switch (_b.label) {
|
|
4594
|
+
case 0:
|
|
4595
|
+
return [4 /*yield*/, getConf(context)];
|
|
4596
|
+
case 1:
|
|
4597
|
+
_a = _b.sent(), influenceAreaRadius = _a.influenceAreaRadius, showInfluenceArea = _a.showInfluenceArea, dissolveOverlappingGeometries = _a.dissolveOverlappingGeometries;
|
|
4598
|
+
return [4 /*yield*/, getGeoJson(context)];
|
|
4599
|
+
case 2:
|
|
4600
|
+
geoJson = _b.sent();
|
|
4601
|
+
if (!(showInfluenceArea && typeof influenceAreaRadius === 'number' && influenceAreaRadius > 0 && Array.isArray(geoJson === null || geoJson === void 0 ? void 0 : geoJson.features) && geoJson.features.length > 0)) return [3 /*break*/, 6];
|
|
4602
|
+
_b.label = 3;
|
|
4603
|
+
case 3:
|
|
4604
|
+
_b.trys.push([3, 5,, 6]);
|
|
4605
|
+
return [4 /*yield*/, GeoReDUSWorker.buffer(geoJson, influenceAreaRadius, {
|
|
4606
|
+
units: 'meters',
|
|
4607
|
+
dissolve: dissolveOverlappingGeometries
|
|
4608
|
+
})];
|
|
4609
|
+
case 4:
|
|
4610
|
+
influenceArea = _b.sent();
|
|
4611
|
+
return [2 /*return*/, influenceArea];
|
|
4612
|
+
case 5:
|
|
4613
|
+
_b.sent();
|
|
4614
|
+
return [2 /*return*/, null];
|
|
4615
|
+
case 6:
|
|
4616
|
+
return [2 /*return*/, null];
|
|
4617
|
+
}
|
|
4618
|
+
});
|
|
4619
|
+
});
|
|
4620
|
+
})
|
|
4621
|
+
};
|
|
4622
|
+
}
|
|
4623
|
+
function influenceAreaSources(_a) {
|
|
4624
|
+
var _b = _a === void 0 ? {} : _a,
|
|
4625
|
+
_c = _b.dataPath,
|
|
4626
|
+
dataPath = _c === void 0 ? 'view.metadata.influenceArea' : _c;
|
|
4627
|
+
return {
|
|
4628
|
+
influenceArea: ['$if', [['$empty', ['$get', dataPath]]], null, {
|
|
4629
|
+
type: 'geojson',
|
|
4630
|
+
data: ['$get', dataPath]
|
|
4631
|
+
}
|
|
4632
|
+
// resolve.fn((context) => {
|
|
4633
|
+
// return {
|
|
4634
|
+
// type: 'geojson',
|
|
4635
|
+
// data: get(context, dataPath),
|
|
4636
|
+
// }
|
|
4637
|
+
// }),
|
|
4638
|
+
]
|
|
4639
|
+
};
|
|
4640
|
+
}
|
|
4641
|
+
function influenceAreaLayers(_a) {
|
|
4642
|
+
var _b = _a === void 0 ? {} : _a,
|
|
4643
|
+
_c = _b.dataPath,
|
|
4644
|
+
dataPath = _c === void 0 ? 'view.metadata.influenceArea' : _c,
|
|
4645
|
+
_d = _b.zIndex,
|
|
4646
|
+
zIndex = _d === void 0 ? ABOVE_BASE_MAP_LAYERS_Z_INDEX_BASE + 1 : _d,
|
|
4647
|
+
_e = _b.fillPaint,
|
|
4648
|
+
fillPaint = _e === void 0 ? {} : _e,
|
|
4649
|
+
_f = _b.boundaryPaint,
|
|
4650
|
+
boundaryPaint = _f === void 0 ? {} : _f;
|
|
4651
|
+
return {
|
|
4652
|
+
influenceArea_fill: {
|
|
4653
|
+
zIndex: zIndex,
|
|
4654
|
+
hidden: ['$empty', ['$get', dataPath]],
|
|
4655
|
+
source: 'influenceArea',
|
|
4656
|
+
type: 'fill',
|
|
4657
|
+
paint: __assign({
|
|
4658
|
+
'fill-color': 'red',
|
|
4659
|
+
'fill-opacity': 0.3
|
|
4660
|
+
}, fillPaint)
|
|
4661
|
+
},
|
|
4662
|
+
influenceArea_boundaries: {
|
|
4663
|
+
zIndex: zIndex,
|
|
4664
|
+
hidden: ['$empty', ['$get', dataPath]],
|
|
4665
|
+
source: 'influenceArea',
|
|
4666
|
+
type: 'line',
|
|
4667
|
+
paint: __assign({
|
|
4668
|
+
'line-color': 'red',
|
|
4669
|
+
'line-opacity': 0.8,
|
|
4670
|
+
'line-width': 2,
|
|
4671
|
+
'line-dasharray': [2, 2]
|
|
4672
|
+
}, boundaryPaint)
|
|
4673
|
+
}
|
|
4674
|
+
};
|
|
4675
|
+
}
|
|
4676
|
+
|
|
4677
|
+
var _excluded$1 = ["version"];
|
|
4463
4678
|
function tableVectorSource(context, tableId) {
|
|
4464
4679
|
var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
4465
4680
|
_ref$version = _ref.version,
|
|
4466
4681
|
version = _ref$version === void 0 ? '1' : _ref$version,
|
|
4467
|
-
override = _objectWithoutProperties(_ref, _excluded);
|
|
4682
|
+
override = _objectWithoutProperties(_ref, _excluded$1);
|
|
4468
4683
|
var VECTOR_TILE_SERVER_ENDPOINT = context.VECTOR_TILE_SERVER_ENDPOINT;
|
|
4469
4684
|
return _objectSpread2({
|
|
4470
4685
|
type: 'vector',
|
|
@@ -4481,18 +4696,6 @@ function vectorLayer(sourceId, override) {
|
|
|
4481
4696
|
}
|
|
4482
4697
|
var BASE_MAP_LAYERS_Z_INDEX_BASE = 100;
|
|
4483
4698
|
var ABOVE_BASE_MAP_LAYERS_Z_INDEX_BASE = 1000;
|
|
4484
|
-
var BASE_MAP_LAYERS_OBJ = BASE_MAP_LAYERS.reduce(function (acc, layer, index) {
|
|
4485
|
-
return _objectSpread2(_objectSpread2({}, acc), {}, _defineProperty({}, slugify(layer.id, '_'), [
|
|
4486
|
-
//
|
|
4487
|
-
// Important! use $literal expression
|
|
4488
|
-
// to avoid unnecessary computing on resolution
|
|
4489
|
-
//
|
|
4490
|
-
'$literal', _objectSpread2(_objectSpread2({}, layer), {}, {
|
|
4491
|
-
interactive: false,
|
|
4492
|
-
zIndex: BASE_MAP_LAYERS_Z_INDEX_BASE + index,
|
|
4493
|
-
source: 'planet'
|
|
4494
|
-
})]));
|
|
4495
|
-
}, {});
|
|
4496
4699
|
function globalResources(context) {
|
|
4497
4700
|
var MUNICIPIO_MALHA_TABLE_ID = 'ibge_malha_br_municipio';
|
|
4498
4701
|
return {
|
|
@@ -4509,7 +4712,7 @@ function globalResources(context) {
|
|
|
4509
4712
|
},
|
|
4510
4713
|
layers: _objectSpread2({
|
|
4511
4714
|
municipio: {
|
|
4512
|
-
zIndex: BASE_MAP_LAYERS_Z_INDEX_BASE +
|
|
4715
|
+
zIndex: BASE_MAP_LAYERS_Z_INDEX_BASE + VEGETATION_AND_WATER_OVERLAY_LAYERS.length + 9,
|
|
4513
4716
|
absoluteId: MUNICIPIO_MALHA_TABLE_ID,
|
|
4514
4717
|
absoluteSourceId: MUNICIPIO_MALHA_TABLE_ID,
|
|
4515
4718
|
'source-layer': "".concat(MUNICIPIO_MALHA_TABLE_ID, ".geom"),
|
|
@@ -4524,7 +4727,21 @@ function globalResources(context) {
|
|
|
4524
4727
|
// 'line-dasharray': [2, 4], // Dash pattern
|
|
4525
4728
|
}
|
|
4526
4729
|
}
|
|
4527
|
-
},
|
|
4730
|
+
}, VEGETATION_AND_WATER_OVERLAY_LAYERS.reduce(function (acc, layer, index) {
|
|
4731
|
+
return _objectSpread2(_objectSpread2({}, acc), {}, _defineProperty({}, slugify(layer.id, '_'), resolve.fn(function (context) {
|
|
4732
|
+
var _context$app;
|
|
4733
|
+
//
|
|
4734
|
+
// It is important to return as literal in
|
|
4735
|
+
// order to avoid unnecessary resolution attempts
|
|
4736
|
+
//
|
|
4737
|
+
return resolve.literal(_objectSpread2(_objectSpread2({}, layer), {}, {
|
|
4738
|
+
hidden: ((_context$app = context.app) === null || _context$app === void 0 ? void 0 : _context$app.baseMapStyle) === 'satellite',
|
|
4739
|
+
interactive: false,
|
|
4740
|
+
zIndex: BASE_MAP_LAYERS_Z_INDEX_BASE + index,
|
|
4741
|
+
source: 'planet'
|
|
4742
|
+
}));
|
|
4743
|
+
})));
|
|
4744
|
+
}, {}))
|
|
4528
4745
|
};
|
|
4529
4746
|
}
|
|
4530
4747
|
|
|
@@ -4543,7 +4760,7 @@ function unflat(obj) {
|
|
|
4543
4760
|
}
|
|
4544
4761
|
|
|
4545
4762
|
var INSUFFICIENT_DATA_COLOR$1 = '#cccccc';
|
|
4546
|
-
function numerical_choropleth
|
|
4763
|
+
function numerical_choropleth(base, _ref) {
|
|
4547
4764
|
var collection_id = _ref.collection_id,
|
|
4548
4765
|
variable_id = _ref.variable_id,
|
|
4549
4766
|
indicator_label = _ref.indicator_label,
|
|
@@ -4713,12 +4930,11 @@ function boolean_categorical$1(base, config) {
|
|
|
4713
4930
|
}
|
|
4714
4931
|
|
|
4715
4932
|
var BY_TYPE$1 = {
|
|
4716
|
-
numerical_choropleth: numerical_choropleth
|
|
4933
|
+
numerical_choropleth: numerical_choropleth,
|
|
4717
4934
|
numerical_size: numerical_size$1,
|
|
4718
4935
|
boolean_categorical: boolean_categorical$1,
|
|
4719
4936
|
categorical: categorical$1
|
|
4720
4937
|
};
|
|
4721
|
-
var DEFAULT_BUFFER_SIZE$1 = 200;
|
|
4722
4938
|
function cem_escolas_2022(config, allViewSpecs, context) {
|
|
4723
4939
|
var collection_id = config.collection_id,
|
|
4724
4940
|
variable_id = config.variable_id,
|
|
@@ -4770,7 +4986,7 @@ function cem_escolas_2022(config, allViewSpecs, context) {
|
|
|
4770
4986
|
metodology: metodology,
|
|
4771
4987
|
keywords: [indicator_path, $sourceLabel, 'educação', keywords].filter(Boolean),
|
|
4772
4988
|
confSchema: {
|
|
4773
|
-
data: {
|
|
4989
|
+
data: _objectSpread2({
|
|
4774
4990
|
variantId: {
|
|
4775
4991
|
label: 'Rede de ensino:',
|
|
4776
4992
|
type: 'treeSelect',
|
|
@@ -4790,40 +5006,10 @@ function cem_escolas_2022(config, allViewSpecs, context) {
|
|
|
4790
5006
|
type: 'booleanCheckbox',
|
|
4791
5007
|
description: 'Tamanho proporcional à quantidade de matrículas',
|
|
4792
5008
|
defaultValue: true
|
|
4793
|
-
} : null
|
|
4794
|
-
|
|
4795
|
-
|
|
4796
|
-
|
|
4797
|
-
description: 'Visualizar área de influência',
|
|
4798
|
-
defaultValue: true
|
|
4799
|
-
},
|
|
4800
|
-
influenceAreaRadius: {
|
|
4801
|
-
type: 'slider',
|
|
4802
|
-
inactive: resolve.literal(resolve.fn(function (context) {
|
|
4803
|
-
var _context$value;
|
|
4804
|
-
return !((_context$value = context.value) !== null && _context$value !== void 0 && _context$value.showInfluenceArea);
|
|
4805
|
-
})),
|
|
4806
|
-
label: resolve.literal(resolve.fn(function (context) {
|
|
4807
|
-
var _context$value2;
|
|
4808
|
-
return "Raio de influ\xEAncia (".concat(((_context$value2 = context.value) === null || _context$value2 === void 0 ? void 0 : _context$value2.influenceAreaRadius) || DEFAULT_BUFFER_SIZE$1, "m)");
|
|
4809
|
-
})),
|
|
4810
|
-
helperText: 'Raio de influência da escola',
|
|
4811
|
-
min: 0,
|
|
4812
|
-
max: 2000,
|
|
4813
|
-
step: 50,
|
|
4814
|
-
defaultValue: DEFAULT_BUFFER_SIZE$1
|
|
4815
|
-
},
|
|
4816
|
-
dissolveOverlappingGeometries: {
|
|
4817
|
-
inactive: resolve.literal(resolve.fn(function (context) {
|
|
4818
|
-
var _context$value3;
|
|
4819
|
-
return !((_context$value3 = context.value) !== null && _context$value3 !== void 0 && _context$value3.showInfluenceArea);
|
|
4820
|
-
})),
|
|
4821
|
-
type: 'booleanCheckbox',
|
|
4822
|
-
label: 'Dissolver geometrias',
|
|
4823
|
-
description: 'Unir geometrias sobrepostas',
|
|
4824
|
-
defaultValue: false
|
|
4825
|
-
}
|
|
4826
|
-
}
|
|
5009
|
+
} : null
|
|
5010
|
+
}, influenceAreaConf({
|
|
5011
|
+
defaultBufferSize: 200
|
|
5012
|
+
}))
|
|
4827
5013
|
},
|
|
4828
5014
|
metadata: {
|
|
4829
5015
|
_value: ['$let', {
|
|
@@ -4835,7 +5021,7 @@ function cem_escolas_2022(config, allViewSpecs, context) {
|
|
|
4835
5021
|
id_municipio: _id_municipio_apiFilterExpr
|
|
4836
5022
|
}, _fetchMetadataApiFilterExpResolver]
|
|
4837
5023
|
}]
|
|
4838
|
-
}, {
|
|
5024
|
+
}, _objectSpread2({
|
|
4839
5025
|
variableValues: ['$get', ['$template', 'rawData[].${0}', VARIABLE_ID]],
|
|
4840
5026
|
sizingValues: sizing_variable_id ? ['$if', ['$get', 'view.conf.data.showSize'], ['$filter', ['$get', ['$template', '[].${0}', sizing_variable_id], ['$fetch', {
|
|
4841
5027
|
href: METADATA_API_ENDPOINT,
|
|
@@ -4844,90 +5030,31 @@ function cem_escolas_2022(config, allViewSpecs, context) {
|
|
|
4844
5030
|
select: sizing_variable_id,
|
|
4845
5031
|
id_municipio: _id_municipio_apiFilterExpr
|
|
4846
5032
|
}, _fetchMetadataApiFilterExpResolver]
|
|
4847
|
-
}]], ['$and', ['$not', ['$empty', ['$iterator', 'item']]], ['$gt', ['$iterator', 'item'], 0]]], null] : null
|
|
4848
|
-
|
|
4849
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(context) {
|
|
4850
|
-
var _ref2, influenceAreaRadius, showInfluenceArea, dissolveOverlappingGeometries, influenceArea;
|
|
4851
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
4852
|
-
while (1) switch (_context.prev = _context.next) {
|
|
4853
|
-
case 0:
|
|
4854
|
-
_ref2 = get(context, 'view.conf.data') || {}, influenceAreaRadius = _ref2.influenceAreaRadius, showInfluenceArea = _ref2.showInfluenceArea, dissolveOverlappingGeometries = _ref2.dissolveOverlappingGeometries;
|
|
4855
|
-
if (!(showInfluenceArea && typeof influenceAreaRadius === 'number' && influenceAreaRadius > 0 && context.rawData)) {
|
|
4856
|
-
_context.next = 12;
|
|
4857
|
-
break;
|
|
4858
|
-
}
|
|
4859
|
-
_context.prev = 2;
|
|
4860
|
-
_context.next = 5;
|
|
4861
|
-
return GeoReDUSWorker.buffer({
|
|
4862
|
-
type: 'FeatureCollection',
|
|
4863
|
-
features: context.rawData.map(function (entry) {
|
|
4864
|
-
return {
|
|
4865
|
-
type: 'Feature',
|
|
4866
|
-
geometry: entry.geom,
|
|
4867
|
-
properties: omit(entry, ['geom'])
|
|
4868
|
-
};
|
|
4869
|
-
})
|
|
4870
|
-
}, influenceAreaRadius, {
|
|
4871
|
-
units: 'meters',
|
|
4872
|
-
dissolve: dissolveOverlappingGeometries
|
|
4873
|
-
});
|
|
4874
|
-
case 5:
|
|
4875
|
-
influenceArea = _context.sent;
|
|
4876
|
-
return _context.abrupt("return", influenceArea);
|
|
4877
|
-
case 9:
|
|
4878
|
-
_context.prev = 9;
|
|
4879
|
-
_context.t0 = _context["catch"](2);
|
|
4880
|
-
return _context.abrupt("return", null);
|
|
4881
|
-
case 12:
|
|
4882
|
-
return _context.abrupt("return", null);
|
|
4883
|
-
case 13:
|
|
4884
|
-
case "end":
|
|
4885
|
-
return _context.stop();
|
|
4886
|
-
}
|
|
4887
|
-
}, _callee, null, [[2, 9]]);
|
|
4888
|
-
}));
|
|
4889
|
-
return function (_x) {
|
|
4890
|
-
return _ref.apply(this, arguments);
|
|
4891
|
-
};
|
|
4892
|
-
}())
|
|
4893
|
-
}]
|
|
5033
|
+
}]], ['$and', ['$not', ['$empty', ['$iterator', 'item']]], ['$gt', ['$iterator', 'item'], 0]]], null] : null
|
|
5034
|
+
}, influenceAreaMetadata())]
|
|
4894
5035
|
},
|
|
4895
|
-
sources: _objectSpread2(_objectSpread2({}, globalRes.sources), {}, _defineProperty(
|
|
5036
|
+
sources: _objectSpread2(_objectSpread2({}, globalRes.sources), {}, _defineProperty({}, VECTOR_SOURCE_ID, tableVectorSource(context, collection_id, {
|
|
4896
5037
|
attribution: $sourceLabel,
|
|
4897
5038
|
promoteId: 'id_escola',
|
|
4898
5039
|
version: 2,
|
|
4899
5040
|
minzoom: 8,
|
|
4900
5041
|
maxzoom: 20
|
|
4901
|
-
})),
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
zIndex: ABOVE_BASE_MAP_LAYERS_Z_INDEX_BASE + 1,
|
|
4910
|
-
hidden: ['$empty', ['$get', 'view.metadata.influenceArea']],
|
|
4911
|
-
source: 'influenceArea',
|
|
4912
|
-
type: 'fill',
|
|
4913
|
-
paint: {
|
|
4914
|
-
'fill-color': get(COLOR_SCHEMES, 'schemeSet1.colors[1]'),
|
|
4915
|
-
'fill-opacity': 0.3
|
|
4916
|
-
}
|
|
5042
|
+
})), influenceAreaSources({
|
|
5043
|
+
dataPath: 'view.metadata.influenceArea'
|
|
5044
|
+
})),
|
|
5045
|
+
layers: _objectSpread2(_objectSpread2({}, globalRes.layers), influenceAreaLayers({
|
|
5046
|
+
dataPath: 'view.metadata.influenceArea',
|
|
5047
|
+
fillPaint: {
|
|
5048
|
+
'fill-color': get(COLOR_SCHEMES, 'schemeSet1.colors[1]'),
|
|
5049
|
+
'fill-opacity': 0.3
|
|
4917
5050
|
},
|
|
4918
|
-
|
|
4919
|
-
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
paint: {
|
|
4924
|
-
'line-color': get(COLOR_SCHEMES, 'schemeSet1.colors[1]'),
|
|
4925
|
-
'line-opacity': 0.8,
|
|
4926
|
-
'line-width': 2,
|
|
4927
|
-
'line-dasharray': [2, 2]
|
|
4928
|
-
}
|
|
5051
|
+
boundaryPaint: {
|
|
5052
|
+
'line-color': get(COLOR_SCHEMES, 'schemeSet1.colors[1]'),
|
|
5053
|
+
'line-opacity': 0.8,
|
|
5054
|
+
'line-width': 2,
|
|
5055
|
+
'line-dasharray': [2, 2]
|
|
4929
5056
|
}
|
|
4930
|
-
}),
|
|
5057
|
+
})),
|
|
4931
5058
|
download: downloadResolver({
|
|
4932
5059
|
fileNameBase: ['$template', '${0}_${1}_georedus_edu', [VARIABLE_ID, ['$get', 'municipioId']]],
|
|
4933
5060
|
mainVariableId: VARIABLE_ID,
|
|
@@ -4943,13 +5070,13 @@ function cem_escolas_2022(config, allViewSpecs, context) {
|
|
|
4943
5070
|
}),
|
|
4944
5071
|
fetchData: resolve.fn(function (context) {
|
|
4945
5072
|
return /*#__PURE__*/function () {
|
|
4946
|
-
var
|
|
5073
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
4947
5074
|
var variableIds;
|
|
4948
|
-
return _regeneratorRuntime().wrap(function
|
|
4949
|
-
while (1) switch (
|
|
5075
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
5076
|
+
while (1) switch (_context.prev = _context.next) {
|
|
4950
5077
|
case 0:
|
|
4951
|
-
variableIds =
|
|
4952
|
-
|
|
5078
|
+
variableIds = _ref.variableIds, _ref.options;
|
|
5079
|
+
_context.next = 3;
|
|
4953
5080
|
return resolveExprAsync(['$fetch', {
|
|
4954
5081
|
href: METADATA_API_ENDPOINT,
|
|
4955
5082
|
pathname: collection_id,
|
|
@@ -4959,15 +5086,15 @@ function cem_escolas_2022(config, allViewSpecs, context) {
|
|
|
4959
5086
|
}, _fetchMetadataApiFilterExpResolver]
|
|
4960
5087
|
}], context);
|
|
4961
5088
|
case 3:
|
|
4962
|
-
return
|
|
5089
|
+
return _context.abrupt("return", _context.sent);
|
|
4963
5090
|
case 4:
|
|
4964
5091
|
case "end":
|
|
4965
|
-
return
|
|
5092
|
+
return _context.stop();
|
|
4966
5093
|
}
|
|
4967
|
-
},
|
|
5094
|
+
}, _callee);
|
|
4968
5095
|
}));
|
|
4969
|
-
return function (
|
|
4970
|
-
return
|
|
5096
|
+
return function (_x) {
|
|
5097
|
+
return _ref2.apply(this, arguments);
|
|
4971
5098
|
};
|
|
4972
5099
|
}();
|
|
4973
5100
|
})
|
|
@@ -5006,16 +5133,16 @@ function cem_escolas_2022(config, allViewSpecs, context) {
|
|
|
5006
5133
|
in_fund_af: 'Fundamental II',
|
|
5007
5134
|
in_med: 'Ensino Médio'
|
|
5008
5135
|
};
|
|
5009
|
-
return Object.entries(ETAPAS).filter(function (
|
|
5136
|
+
return Object.entries(ETAPAS).filter(function (_ref3) {
|
|
5010
5137
|
var _context$feature, _context$feature2;
|
|
5011
|
-
var
|
|
5012
|
-
key =
|
|
5013
|
-
|
|
5138
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
|
5139
|
+
key = _ref4[0];
|
|
5140
|
+
_ref4[1];
|
|
5014
5141
|
return (context === null || context === void 0 || (_context$feature = context.feature) === null || _context$feature === void 0 ? void 0 : _context$feature.properties) && (context === null || context === void 0 || (_context$feature2 = context.feature) === null || _context$feature2 === void 0 ? void 0 : _context$feature2.properties[key]);
|
|
5015
|
-
}).map(function (
|
|
5016
|
-
var
|
|
5017
|
-
|
|
5018
|
-
var label =
|
|
5142
|
+
}).map(function (_ref5) {
|
|
5143
|
+
var _ref6 = _slicedToArray(_ref5, 2);
|
|
5144
|
+
_ref6[0];
|
|
5145
|
+
var label = _ref6[1];
|
|
5019
5146
|
return label;
|
|
5020
5147
|
}).join(', ');
|
|
5021
5148
|
})]], ['Rede de ensino', ['$literal', ['$get', 'feature.properties.tp_dependencia']]]].filter(Boolean)
|
|
@@ -5183,6 +5310,17 @@ function cem_censo_2010_2022(viewSpec, allViewSpecs, context) {
|
|
|
5183
5310
|
number: NUMBER_FMT || ['pt-BR', {}],
|
|
5184
5311
|
below: 'Sem dados',
|
|
5185
5312
|
above: ['$if', ['$empty', ['$get', 'view.metadata.colorScaleStops']], null, 'Acima de ${0}']
|
|
5313
|
+
},
|
|
5314
|
+
//
|
|
5315
|
+
// TODO: review! Clearly not structured manner.
|
|
5316
|
+
// Currently used @ GeoReDUS/GeoReDUS.jsx
|
|
5317
|
+
//
|
|
5318
|
+
__filterFeaturesForStep: function __filterFeaturesForStep(stepInfo, features) {
|
|
5319
|
+
return features.filter(function (feature) {
|
|
5320
|
+
var _feature$properties;
|
|
5321
|
+
var value = (_feature$properties = feature.properties) === null || _feature$properties === void 0 ? void 0 : _feature$properties[variable_id];
|
|
5322
|
+
return typeof value === 'number' && value >= stepInfo.min && (value <= stepInfo.max || stepInfo.max === null);
|
|
5323
|
+
});
|
|
5186
5324
|
}
|
|
5187
5325
|
|
|
5188
5326
|
// format: {
|
|
@@ -5540,7 +5678,7 @@ function cem_censo_2010_2022(viewSpec, allViewSpecs, context) {
|
|
|
5540
5678
|
}
|
|
5541
5679
|
}]]]]
|
|
5542
5680
|
})),
|
|
5543
|
-
layers: _objectSpread2(_objectSpread2({}, globalRes.layers), {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty({
|
|
5681
|
+
layers: _objectSpread2(_objectSpread2({}, globalRes.layers), {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
|
|
5544
5682
|
customGeoJSON_Areas_fill: {
|
|
5545
5683
|
hidden: ['$empty', ['$get', 'view.conf.data.customSpatialAggregationUnit']],
|
|
5546
5684
|
source: 'customGeoJSON_Areas',
|
|
@@ -5615,26 +5753,17 @@ function cem_censo_2010_2022(viewSpec, allViewSpecs, context) {
|
|
|
5615
5753
|
type: 'fill',
|
|
5616
5754
|
// maxzoom: 14,
|
|
5617
5755
|
paint: {
|
|
5618
|
-
// 'fill-color': [
|
|
5619
|
-
// '$flat',
|
|
5620
|
-
// [
|
|
5621
|
-
// [
|
|
5622
|
-
// 'step',
|
|
5623
|
-
// [
|
|
5624
|
-
// 'coalesce',
|
|
5625
|
-
// ['get', ['$get', 'view.conf.data.variableId']],
|
|
5626
|
-
// -1,
|
|
5627
|
-
// ],
|
|
5628
|
-
// ],
|
|
5629
|
-
// ['$get', 'view.metadata.colorScaleStops'],
|
|
5630
|
-
// ],
|
|
5631
|
-
// ],
|
|
5632
5756
|
'fill-color': _vectorSourceFillColor,
|
|
5633
|
-
|
|
5634
|
-
|
|
5635
|
-
//
|
|
5636
|
-
|
|
5637
|
-
],
|
|
5757
|
+
'fill-opacity': ['step', ['zoom'],
|
|
5758
|
+
//
|
|
5759
|
+
// At lower zooms, opacities should be high
|
|
5760
|
+
//
|
|
5761
|
+
['case', ['boolean', ['feature-state', 'hover'], false], 1, ['$get', 'view.conf.style.layerOpacity']], BUILDINGS_MIN_ZOOM,
|
|
5762
|
+
//
|
|
5763
|
+
// At higher zooms, opacity should be low,
|
|
5764
|
+
// so that buildings show up
|
|
5765
|
+
//
|
|
5766
|
+
['case', ['boolean', ['feature-state', 'hover'], false], 0.2, 0.1]],
|
|
5638
5767
|
'fill-outline-color': 'transparent'
|
|
5639
5768
|
}
|
|
5640
5769
|
}), "".concat(VECTOR_SOURCE_ID, "_boundary_lines"), {
|
|
@@ -5645,16 +5774,36 @@ function cem_censo_2010_2022(viewSpec, allViewSpecs, context) {
|
|
|
5645
5774
|
interactive: true,
|
|
5646
5775
|
// minzoom: BUILDINGS_MIN_ZOOM,
|
|
5647
5776
|
paint: {
|
|
5648
|
-
'line-color': _vectorSourceFillColor,
|
|
5777
|
+
// 'line-color': _vectorSourceFillColor,
|
|
5778
|
+
'line-color': _color_scheme.scalesByK[3][2],
|
|
5649
5779
|
'line-width': ['step', ['zoom'],
|
|
5650
5780
|
// default: zoom < 14 → thin lines
|
|
5651
|
-
['case', ['boolean', ['feature-state', 'hover'], false],
|
|
5781
|
+
['case', ['boolean', ['feature-state', 'hover'], false], 2, 0], BUILDINGS_MIN_ZOOM,
|
|
5652
5782
|
// zoom ≥ 14 → larger lines
|
|
5653
|
-
['case', ['boolean', ['feature-state', 'hover'], false],
|
|
5654
|
-
'line-opacity': ['case', ['boolean', ['feature-state', 'hover'], false], 1, ['$get', 'view.conf.style.layerOpacity']]
|
|
5655
|
-
'line-dasharray': [2, 2]
|
|
5783
|
+
['case', ['boolean', ['feature-state', 'hover'], false], 4, 0]],
|
|
5784
|
+
'line-opacity': ['case', ['boolean', ['feature-state', 'hover'], false], 1, ['$get', 'view.conf.style.layerOpacity']]
|
|
5656
5785
|
}
|
|
5657
|
-
}), "".concat(VECTOR_SOURCE_ID, "
|
|
5786
|
+
}), "".concat(VECTOR_SOURCE_ID, "_buildings_fill"), {
|
|
5787
|
+
hidden: ['$not', ['$empty', ['$get', 'view.metadata.customGeoJSON.AREAS']]],
|
|
5788
|
+
interactive: false,
|
|
5789
|
+
source: "".concat(VECTOR_SOURCE_ID, "_buildings"),
|
|
5790
|
+
'source-layer': 'dvt',
|
|
5791
|
+
type: 'fill',
|
|
5792
|
+
minzoom: BUILDINGS_MIN_ZOOM,
|
|
5793
|
+
paint: {
|
|
5794
|
+
//
|
|
5795
|
+
// If indicator is about populacao-e-domicilios,
|
|
5796
|
+
// do not color paint buildings whose subtype
|
|
5797
|
+
// is known and is not residential.
|
|
5798
|
+
//
|
|
5799
|
+
// Otherwise, apply color to all buildings
|
|
5800
|
+
//
|
|
5801
|
+
'fill-color': indicator_path !== null && indicator_path !== void 0 && indicator_path.startsWith('População e domicílios') ? ['case', ['in', ['get', 'subtype'], ['literal', ['agricultural', 'civic', 'commercial', 'education', 'entertainment', 'industrial', 'medical', 'military', 'outbuilding', 'religious',
|
|
5802
|
+
// 'residential',
|
|
5803
|
+
'service', 'transportation']]], '#EFEFEF', _vectorSourceFillColor] : _vectorSourceFillColor,
|
|
5804
|
+
'fill-opacity': 1
|
|
5805
|
+
}
|
|
5806
|
+
}), "".concat(VECTOR_SOURCE_ID, "_buildings_fill_extrusion"), {
|
|
5658
5807
|
hidden: ['$not', ['$empty', ['$get', 'view.metadata.customGeoJSON.AREAS']]],
|
|
5659
5808
|
interactive: false,
|
|
5660
5809
|
// tooltip: {
|
|
@@ -5737,69 +5886,6 @@ function cem_censo_2010_2022(viewSpec, allViewSpecs, context) {
|
|
|
5737
5886
|
};
|
|
5738
5887
|
}
|
|
5739
5888
|
|
|
5740
|
-
function numerical_choropleth(base, _ref) {
|
|
5741
|
-
var collection_id = _ref.collection_id,
|
|
5742
|
-
indicator_id = _ref.indicator_id,
|
|
5743
|
-
indicator_label = _ref.indicator_label,
|
|
5744
|
-
_ref$color_scheme = _ref.color_scheme,
|
|
5745
|
-
color_scheme = _ref$color_scheme === void 0 ? 'schemeRdYlBu' : _ref$color_scheme,
|
|
5746
|
-
measure_unit = _ref.measure_unit,
|
|
5747
|
-
$circleRadius = _ref.$circleRadius,
|
|
5748
|
-
$tooltip = _ref.$tooltip,
|
|
5749
|
-
$legends = _ref.$legends;
|
|
5750
|
-
var VARIABLE_ID = indicator_id;
|
|
5751
|
-
var TABLE_ID = collection_id;
|
|
5752
|
-
var VECTOR_SOURCE_ID = "".concat(TABLE_ID, ".geom");
|
|
5753
|
-
|
|
5754
|
-
// const viewId = `${collection_id}.${VARIABLE_ID}`
|
|
5755
|
-
|
|
5756
|
-
var _color_scheme = COLOR_SCHEMES[color_scheme];
|
|
5757
|
-
return _objectSpread2(_objectSpread2({}, base), {}, {
|
|
5758
|
-
metadata: ['$let', base.metadata, {
|
|
5759
|
-
variableValues: ['$get', 'variableValues'],
|
|
5760
|
-
sizingValues: ['$get', 'sizingValues'],
|
|
5761
|
-
colorScaleStops: ['$naturalBreaks', ['$get', 'variableValues'], ['$merge', _color_scheme, {
|
|
5762
|
-
minK: 5
|
|
5763
|
-
}]]
|
|
5764
|
-
}],
|
|
5765
|
-
layers: _objectSpread2(_objectSpread2({}, base.layers), {}, _defineProperty({}, "".concat(VECTOR_SOURCE_ID, "_circle"), vectorLayer(VECTOR_SOURCE_ID, {
|
|
5766
|
-
zIndex: ABOVE_BASE_MAP_LAYERS_Z_INDEX_BASE,
|
|
5767
|
-
type: 'circle',
|
|
5768
|
-
legends: [{
|
|
5769
|
-
type: 'SequentialColorLegend',
|
|
5770
|
-
title: indicator_label,
|
|
5771
|
-
unit: measure_unit,
|
|
5772
|
-
steps: ['$get', 'view.metadata.colorScaleStops']
|
|
5773
|
-
}].concat(_toConsumableArray($legends)),
|
|
5774
|
-
interactive: true,
|
|
5775
|
-
tooltip: $tooltip,
|
|
5776
|
-
// tooltip: {
|
|
5777
|
-
// title: ['$literal', ['$get', 'feature.properties.no_entidade']],
|
|
5778
|
-
// entries: [
|
|
5779
|
-
// [
|
|
5780
|
-
// indicator_label,
|
|
5781
|
-
// [
|
|
5782
|
-
// '$literal',
|
|
5783
|
-
// [
|
|
5784
|
-
// '$get',
|
|
5785
|
-
// `feature.properties.${VARIABLE_ID}::string({ "number": ["pt-BR"] })`,
|
|
5786
|
-
// ],
|
|
5787
|
-
// ],
|
|
5788
|
-
// ],
|
|
5789
|
-
// ],
|
|
5790
|
-
// },
|
|
5791
|
-
filter: ['all', ['==', ['get', 'id_municipio'], ['$get', 'municipioId']], ['==', ['typeof', ['get', VARIABLE_ID]], 'number']],
|
|
5792
|
-
paint: {
|
|
5793
|
-
'circle-opacity': 1,
|
|
5794
|
-
'circle-radius': $circleRadius,
|
|
5795
|
-
'circle-stroke-width': 1,
|
|
5796
|
-
'circle-stroke-color': '#efefef',
|
|
5797
|
-
'circle-color': ['$flat', [['step', ['get', VARIABLE_ID]], ['$get', 'view.metadata.colorScaleStops']]]
|
|
5798
|
-
}
|
|
5799
|
-
})))
|
|
5800
|
-
});
|
|
5801
|
-
}
|
|
5802
|
-
|
|
5803
5889
|
function numerical_size(base, _ref) {
|
|
5804
5890
|
var collection_id = _ref.collection_id,
|
|
5805
5891
|
variable_id = _ref.variable_id,
|
|
@@ -5816,7 +5902,7 @@ function numerical_size(base, _ref) {
|
|
|
5816
5902
|
var SIZE_MIN = 6;
|
|
5817
5903
|
return _objectSpread2(_objectSpread2({}, base), {}, {
|
|
5818
5904
|
layers: _objectSpread2(_objectSpread2({}, base.layers), {}, _defineProperty({}, "".concat(VECTOR_SOURCE_ID, "_circle"), vectorLayer(VECTOR_SOURCE_ID, {
|
|
5819
|
-
zIndex: ABOVE_BASE_MAP_LAYERS_Z_INDEX_BASE,
|
|
5905
|
+
zIndex: ABOVE_BASE_MAP_LAYERS_Z_INDEX_BASE + 2,
|
|
5820
5906
|
type: 'circle',
|
|
5821
5907
|
legends: [{
|
|
5822
5908
|
type: 'ProportionalSymbolLegend',
|
|
@@ -5833,26 +5919,17 @@ function numerical_size(base, _ref) {
|
|
|
5833
5919
|
interactive: true,
|
|
5834
5920
|
tooltip: $tooltip,
|
|
5835
5921
|
filter: $layerFilter,
|
|
5836
|
-
// filter: [
|
|
5837
|
-
// 'all',
|
|
5838
|
-
// [
|
|
5839
|
-
// '==',
|
|
5840
|
-
// ['get', 'id_municipio_gestor'],
|
|
5841
|
-
// ['$substr', ['$get', 'municipioId'], 0, 6],
|
|
5842
|
-
// ],
|
|
5843
|
-
// ...(Array.isArray(filter) ? filter : []),
|
|
5844
|
-
// ],
|
|
5845
5922
|
paint: {
|
|
5846
5923
|
'circle-opacity': 1,
|
|
5847
5924
|
'circle-stroke-width': 1,
|
|
5848
5925
|
'circle-stroke-color': '#000000',
|
|
5849
|
-
|
|
5850
|
-
|
|
5851
|
-
|
|
5852
|
-
|
|
5853
|
-
|
|
5854
|
-
|
|
5855
|
-
],
|
|
5926
|
+
'circle-radius': ['$if', ['$gt', ['$get', 'length', ['$get', 'view.metadata.variableValues']], 1], zoomSensitiveLinearSizes({
|
|
5927
|
+
variable: ['get', VARIABLE_ID],
|
|
5928
|
+
minValue: ['$min', ['$get', 'view.metadata.variableValues']],
|
|
5929
|
+
maxValue: ['$max', ['$get', 'view.metadata.variableValues']],
|
|
5930
|
+
minSize: SIZE_MIN,
|
|
5931
|
+
maxSize: SIZE_MAX
|
|
5932
|
+
}), 10],
|
|
5856
5933
|
'circle-color': get(COLOR_SCHEMES, color_scheme) || color_scheme
|
|
5857
5934
|
}
|
|
5858
5935
|
})))
|
|
@@ -5878,13 +5955,23 @@ function categorical(base, _ref) {
|
|
|
5878
5955
|
color: get(COLOR_SCHEMES, category.color) || category.color
|
|
5879
5956
|
});
|
|
5880
5957
|
}) : null;
|
|
5958
|
+
var $circleColor = categories ? ['match', ['to-string', ['get', VARIABLE_ID]]].concat(_toConsumableArray(categories.flatMap(function (category) {
|
|
5959
|
+
return [category.value, category.color];
|
|
5960
|
+
})), [DEFAULT_NULL_COLOR]) : DEFAULT_NULL_COLOR;
|
|
5881
5961
|
return _objectSpread2(_objectSpread2({}, base), {}, {
|
|
5882
|
-
|
|
5883
|
-
|
|
5884
|
-
|
|
5885
|
-
|
|
5886
|
-
|
|
5887
|
-
|
|
5962
|
+
layers: _objectSpread2(_objectSpread2({}, base.layers), {}, _defineProperty({
|
|
5963
|
+
influenceArea_fill: _objectSpread2(_objectSpread2({}, base.layers.influenceArea_fill), {}, {
|
|
5964
|
+
paint: _objectSpread2(_objectSpread2({}, base.layers.influenceArea_fill.paint), {}, {
|
|
5965
|
+
'fill-color': $circleColor
|
|
5966
|
+
})
|
|
5967
|
+
}),
|
|
5968
|
+
influenceArea_boundaries: _objectSpread2(_objectSpread2({}, base.layers.influenceArea_boundaries), {}, {
|
|
5969
|
+
paint: _objectSpread2(_objectSpread2({}, base.layers.influenceArea_boundaries.paint), {}, {
|
|
5970
|
+
'line-color': $circleColor
|
|
5971
|
+
})
|
|
5972
|
+
})
|
|
5973
|
+
}, "".concat(VECTOR_SOURCE_ID, "_circle"), vectorLayer(VECTOR_SOURCE_ID, {
|
|
5974
|
+
zIndex: ABOVE_BASE_MAP_LAYERS_Z_INDEX_BASE + 2,
|
|
5888
5975
|
type: 'circle',
|
|
5889
5976
|
legends: [categories ? {
|
|
5890
5977
|
type: 'ColorLegend',
|
|
@@ -5919,9 +6006,7 @@ function categorical(base, _ref) {
|
|
|
5919
6006
|
'circle-radius': 10,
|
|
5920
6007
|
'circle-stroke-width': 1,
|
|
5921
6008
|
'circle-stroke-color': '#000000'
|
|
5922
|
-
}, "circle-radius", $circleRadius), 'circle-color',
|
|
5923
|
-
return [category.value, category.color];
|
|
5924
|
-
})), [DEFAULT_NULL_COLOR]) : DEFAULT_NULL_COLOR)
|
|
6009
|
+
}, "circle-radius", $circleRadius), 'circle-color', $circleColor)
|
|
5925
6010
|
})))
|
|
5926
6011
|
});
|
|
5927
6012
|
}
|
|
@@ -5944,7 +6029,7 @@ function boolean_categorical(base, config) {
|
|
|
5944
6029
|
}
|
|
5945
6030
|
|
|
5946
6031
|
var BY_TYPE = {
|
|
5947
|
-
|
|
6032
|
+
// numerical_choropleth,
|
|
5948
6033
|
numerical_size: numerical_size,
|
|
5949
6034
|
boolean_categorical: boolean_categorical,
|
|
5950
6035
|
categorical: categorical
|
|
@@ -5958,6 +6043,7 @@ function cem_saude_2024(viewSpec, allViewSpecs, context) {
|
|
|
5958
6043
|
indicator_label = viewSpec.indicator_label,
|
|
5959
6044
|
indicator_type = viewSpec.indicator_type,
|
|
5960
6045
|
sizing_variable_id = viewSpec.sizing_variable_id,
|
|
6046
|
+
tipo_estabelecimento = viewSpec.tipo_estabelecimento,
|
|
5961
6047
|
_viewSpec$number_form = viewSpec.number_format,
|
|
5962
6048
|
number_format = _viewSpec$number_form === void 0 ? ['pt-BR', {}] : _viewSpec$number_form,
|
|
5963
6049
|
keywords = viewSpec.keywords;
|
|
@@ -5998,49 +6084,55 @@ function cem_saude_2024(viewSpec, allViewSpecs, context) {
|
|
|
5998
6084
|
metodology: metodology,
|
|
5999
6085
|
keywords: [indicator_path, $sourceLabel, 'saúde', 'hospital', 'UBS', keywords].filter(Boolean),
|
|
6000
6086
|
confSchema: {
|
|
6001
|
-
data: {
|
|
6002
|
-
|
|
6003
|
-
|
|
6004
|
-
|
|
6005
|
-
// options: variants.map((variant) => ({
|
|
6006
|
-
// path: variant.variant_path,
|
|
6007
|
-
// label: variant.variant_label || variant.indicator_id,
|
|
6008
|
-
// value: variant.indicator_id,
|
|
6009
|
-
// })),
|
|
6010
|
-
// placeholder: 'Selecione uma rede',
|
|
6011
|
-
// clearable: false,
|
|
6012
|
-
// defaultValue: indicator_id,
|
|
6013
|
-
// },
|
|
6014
|
-
}
|
|
6087
|
+
data: _objectSpread2({}, influenceAreaConf({
|
|
6088
|
+
defaultBufferSize: tipo_estabelecimento === 'HOSPITAL' ? 2000 : 500,
|
|
6089
|
+
maxBufferSize: 5000
|
|
6090
|
+
}))
|
|
6015
6091
|
},
|
|
6016
6092
|
metadata: {
|
|
6017
|
-
|
|
6018
|
-
|
|
6019
|
-
|
|
6020
|
-
|
|
6021
|
-
|
|
6022
|
-
|
|
6023
|
-
|
|
6024
|
-
|
|
6025
|
-
|
|
6026
|
-
|
|
6027
|
-
|
|
6028
|
-
|
|
6029
|
-
|
|
6030
|
-
|
|
6031
|
-
|
|
6032
|
-
|
|
6033
|
-
|
|
6034
|
-
|
|
6035
|
-
|
|
6093
|
+
_value: ['$let', {
|
|
6094
|
+
rawData: ['$fetch', {
|
|
6095
|
+
href: METADATA_API_ENDPOINT,
|
|
6096
|
+
pathname: collection_id,
|
|
6097
|
+
searchParams: ['$merge', {
|
|
6098
|
+
select: [VARIABLE_ID, 'geom'].join(','),
|
|
6099
|
+
id_municipio_gestor: _id_municipio_gestor_apiFilterExp
|
|
6100
|
+
}, _fetchMetadataApiFilterExpResolver]
|
|
6101
|
+
}]
|
|
6102
|
+
}, _objectSpread2(_objectSpread2({
|
|
6103
|
+
variableValues: ['$get', ['$template', 'rawData[].${0}', VARIABLE_ID]]
|
|
6104
|
+
}, influenceAreaMetadata()), {}, {
|
|
6105
|
+
sizingValues: sizing_variable_id ? ['$filter', ['$get', ['$template', '[].${0}', sizing_variable_id
|
|
6106
|
+
// ['$get', 'view.conf.data.sizingVariable'],
|
|
6107
|
+
], ['$fetch', {
|
|
6108
|
+
href: METADATA_API_ENDPOINT,
|
|
6109
|
+
pathname: collection_id,
|
|
6110
|
+
searchParams: ['$merge', {
|
|
6111
|
+
select: sizing_variable_id,
|
|
6112
|
+
// select: ['$get', 'view.conf.data.sizingVariable'],
|
|
6113
|
+
id_municipio_gestor: _id_municipio_gestor_apiFilterExp
|
|
6114
|
+
}, _fetchMetadataApiFilterExpResolver]
|
|
6115
|
+
}]], ['$and', ['$not', ['$empty', ['$iterator', 'item']]], ['$gt', ['$iterator', 'item'], 0]]] : null
|
|
6116
|
+
})]
|
|
6036
6117
|
},
|
|
6037
6118
|
sources: _objectSpread2(_objectSpread2({}, globalRes.sources), {}, _defineProperty({}, VECTOR_SOURCE_ID, tableVectorSource(context, collection_id, {
|
|
6038
6119
|
attribution: $sourceLabel,
|
|
6039
6120
|
promoteId: 'id_cnes',
|
|
6040
6121
|
minzoom: 8,
|
|
6041
6122
|
maxzoom: 20
|
|
6042
|
-
}))),
|
|
6043
|
-
layers: _objectSpread2({}, globalRes.layers),
|
|
6123
|
+
})), influenceAreaSources()),
|
|
6124
|
+
layers: _objectSpread2(_objectSpread2({}, globalRes.layers), influenceAreaLayers({
|
|
6125
|
+
fillPaint: {
|
|
6126
|
+
'fill-color': colorScheme('schemeSet1.colors[2]'),
|
|
6127
|
+
'fill-opacity': 0.3
|
|
6128
|
+
},
|
|
6129
|
+
boundaryPaint: {
|
|
6130
|
+
'line-color': colorScheme('schemeSet1.colors[2]'),
|
|
6131
|
+
'line-opacity': 0.8,
|
|
6132
|
+
'line-width': 2,
|
|
6133
|
+
'line-dasharray': [2, 2]
|
|
6134
|
+
}
|
|
6135
|
+
})),
|
|
6044
6136
|
download: downloadResolver({
|
|
6045
6137
|
fileNameBase: ['$template', '${0}_${1}_georedus_saude', [VARIABLE_ID, ['$get', 'municipioId']]],
|
|
6046
6138
|
mainVariableId: VARIABLE_ID,
|
|
@@ -6108,14 +6200,23 @@ function cem_saude_2024(viewSpec, allViewSpecs, context) {
|
|
|
6108
6200
|
// ]
|
|
6109
6201
|
// : SIZE_DEFAULT
|
|
6110
6202
|
|
|
6111
|
-
var $circleRadius = sizing_variable_id ? ['$if', ['$
|
|
6112
|
-
|
|
6113
|
-
|
|
6114
|
-
|
|
6115
|
-
|
|
6116
|
-
|
|
6117
|
-
|
|
6118
|
-
|
|
6203
|
+
var $circleRadius = sizing_variable_id ? ['$if', ['$gt', ['$get', 'length', ['$get', 'view.metadata.sizingValues']], 1], zoomSensitiveLinearSizes({
|
|
6204
|
+
variable: ['get', sizing_variable_id],
|
|
6205
|
+
minValue: ['$min', ['$get', 'view.metadata.sizingValues']],
|
|
6206
|
+
maxValue: ['$max', ['$get', 'view.metadata.sizingValues']],
|
|
6207
|
+
minSize: SIZE_MIN,
|
|
6208
|
+
maxSize: SIZE_MAX
|
|
6209
|
+
}),
|
|
6210
|
+
// [
|
|
6211
|
+
// 'interpolate',
|
|
6212
|
+
// ['linear'],
|
|
6213
|
+
// ['get', sizing_variable_id], // Replace "density" with your property name
|
|
6214
|
+
// ['$min', ['$get', 'view.metadata.sizingValues']],
|
|
6215
|
+
// SIZE_MIN, // When qt_mat_fund_ai is 0, radius is 6
|
|
6216
|
+
// ['$max', ['$get', 'view.metadata.sizingValues']],
|
|
6217
|
+
// SIZE_MAX, // When qt_mat_fund_ai is 100, radius is 20
|
|
6218
|
+
// ],
|
|
6219
|
+
SIZE_DEFAULT] : SIZE_DEFAULT;
|
|
6119
6220
|
var $tooltip = {
|
|
6120
6221
|
title: ['$literal', ['$get', 'feature.properties.str_nome_fantasia']],
|
|
6121
6222
|
entries: [['ID CNES', ['$literal', ['$get', 'feature.properties.id_cnes']]], [indicator_label, ['$literal', ['$coalesce', ['$get', "feature.properties.".concat(VARIABLE_ID, "::string({\n number: ").concat(JSON.stringify(number_format), ",\n boolean: {\n true: 'Sim',\n false: 'N\xE3o'\n }\n })")], 'Sem dados']]
|
|
@@ -6322,12 +6423,17 @@ var resolveControls = _stageResolver('controls', function (controls, _a) {
|
|
|
6322
6423
|
}
|
|
6323
6424
|
var view = _a.view,
|
|
6324
6425
|
viewSpec = _a.viewSpec;
|
|
6325
|
-
|
|
6326
|
-
|
|
6327
|
-
|
|
6328
|
-
|
|
6329
|
-
|
|
6330
|
-
|
|
6426
|
+
var layerLegends = view.layers ? Object.entries(view.layers).flatMap(function (_a) {
|
|
6427
|
+
var layerRelativeId = _a[0],
|
|
6428
|
+
layer = _a[1];
|
|
6429
|
+
return layer.hidden || layer.visibility === 'none' ? [] : (layer.legends || []).map(function (legend, index) {
|
|
6430
|
+
return __assign(__assign({}, legend), {
|
|
6431
|
+
//
|
|
6432
|
+
// TODO: review if there is a better approach
|
|
6433
|
+
//
|
|
6434
|
+
layerId: fmtLayerAbsoluteId(view.id, layerRelativeId),
|
|
6435
|
+
id: "".concat(viewSpec.id, "_").concat(index)
|
|
6436
|
+
});
|
|
6331
6437
|
});
|
|
6332
6438
|
}) : [];
|
|
6333
6439
|
return __assign(__assign({}, controls || {}), {
|
|
@@ -6712,7 +6818,7 @@ function useViewStageQueries(_a) {
|
|
|
6712
6818
|
var stageDependencies = enabled && typeof ((_a = viewSpec[stageKey]) === null || _a === void 0 ? void 0 : _a._dependencies) === 'function' ? viewSpec[stageKey]._dependencies(__assign(__assign({}, viewResolutionContextBase), {
|
|
6713
6819
|
view: partialView
|
|
6714
6820
|
})) || 'STABLE_DEPENDENCY' : 'STABLE_DEPENDENCY';
|
|
6715
|
-
var queryKey = ['ViewStage', viewId, stageKey, viewConf, viewResolutionContextBase.app
|
|
6821
|
+
var queryKey = ['ViewStage', viewId, stageKey, viewConf, viewResolutionContextBase.app, stageDependencies];
|
|
6716
6822
|
return __assign(__assign({}, ((_b = viewSpec[stageKey]) === null || _b === void 0 ? void 0 : _b._query) ? pick((_c = viewSpec[stageKey]) === null || _c === void 0 ? void 0 : _c._query, ['gcTime']) : {}), {
|
|
6717
6823
|
gcTime: 0,
|
|
6718
6824
|
enabled: enabled,
|
|
@@ -6939,6 +7045,36 @@ function useViews(viewResolutionContextBase) {
|
|
|
6939
7045
|
};
|
|
6940
7046
|
}
|
|
6941
7047
|
|
|
7048
|
+
function useMapStyle(input, modifier) {
|
|
7049
|
+
var _this = this;
|
|
7050
|
+
var styleQuery = useQuery({
|
|
7051
|
+
queryKey: ['MapStyle', input],
|
|
7052
|
+
queryFn: function queryFn() {
|
|
7053
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
7054
|
+
var res, baseStyle;
|
|
7055
|
+
return __generator(this, function (_a) {
|
|
7056
|
+
switch (_a.label) {
|
|
7057
|
+
case 0:
|
|
7058
|
+
if (_typeof(input) === 'object') return [2 /*return*/, input];
|
|
7059
|
+
return [4 /*yield*/, fetch(input)];
|
|
7060
|
+
case 1:
|
|
7061
|
+
res = _a.sent();
|
|
7062
|
+
if (!res.ok) throw new Error("Failed to fetch style: ".concat(res.status));
|
|
7063
|
+
return [4 /*yield*/, res.json()];
|
|
7064
|
+
case 2:
|
|
7065
|
+
baseStyle = _a.sent();
|
|
7066
|
+
return [2 /*return*/, typeof modifier === 'function' ? modifier(baseStyle) : baseStyle];
|
|
7067
|
+
}
|
|
7068
|
+
});
|
|
7069
|
+
});
|
|
7070
|
+
},
|
|
7071
|
+
staleTime: Infinity,
|
|
7072
|
+
enabled: !!input
|
|
7073
|
+
});
|
|
7074
|
+
return styleQuery.data || null;
|
|
7075
|
+
}
|
|
7076
|
+
|
|
7077
|
+
var _excluded = ["layerId", "__filterFeaturesForStep"];
|
|
6942
7078
|
var _templateObject, _templateObject2, _templateObject3;
|
|
6943
7079
|
|
|
6944
7080
|
//
|
|
@@ -6985,16 +7121,18 @@ function _flyToMunicipio2() {
|
|
|
6985
7121
|
return _flyToMunicipio2.apply(this, arguments);
|
|
6986
7122
|
}
|
|
6987
7123
|
var REDUS_DATAVIZ_STYLE = 'https://api.maptiler.com/maps/0195f947-fb77-7256-83d6-47a54db345a3/style.json';
|
|
7124
|
+
var REDUS_SATELLITE_STYLE = 'https://api.maptiler.com/maps/0196a042-ce24-74d5-8c4a-aacddb89c9ca/style.json';
|
|
6988
7125
|
// const REDUS_DATAVIZ_STYLE =
|
|
6989
7126
|
// 'https://api.maptiler.com/maps/streets-v2/style.json'
|
|
6990
7127
|
// const MAP_STYLE_URL = `https://api.maptiler.com/maps/dataviz/style.json?key=${process.env.NEXT_PUBLIC_MAP_TILER_API_KEY}`
|
|
6991
7128
|
var DATAVIZ_MAP_STYLE_URL = "".concat(REDUS_DATAVIZ_STYLE, "?key=").concat(process.env.NEXT_PUBLIC_MAP_TILER_API_KEY);
|
|
6992
|
-
var SATELLITE_MAP_STYLE_URL = "
|
|
7129
|
+
var SATELLITE_MAP_STYLE_URL = "".concat(REDUS_SATELLITE_STYLE, "?key=").concat(process.env.NEXT_PUBLIC_MAP_TILER_API_KEY);
|
|
6993
7130
|
//
|
|
6994
7131
|
// For elevation rendering
|
|
6995
7132
|
//
|
|
6996
7133
|
var DEM_SOURCE_URL = "https://api.maptiler.com/tiles/terrain-rgb-v2/{z}/{x}/{y}.webp?key=".concat(process.env.NEXT_PUBLIC_MAP_TILER_API_KEY);
|
|
6997
7134
|
var DEM_SOURCE_ENCODING = 'mapbox';
|
|
7135
|
+
var GLYPHS_URL = "https://api.maptiler.com/fonts/{fontstack}/{range}.pbf?key=".concat(process.env.NEXT_PUBLIC_MAP_TILER_API_KEY);
|
|
6998
7136
|
var MapStyleToggleCtrl = styled.button(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n height: 100px;\n width: 100px;\n\n padding: 0;\n border: none;\n background-color: #efefef;\n border-radius: 0;\n box-shadow:\n rgba(50, 50, 93, 0.25) 0px 2px 5px -1px,\n rgba(0, 0, 0, 0.3) 0px 1px 3px -1px;\n\n cursor: pointer;\n\n &::after {\n z-index: 2;\n content: 'Trocar camada base';\n color: transparent;\n font-weight: bold;\n display: flex;\n padding: 8px;\n justify-content: center;\n align-items: center;\n text-align: center;\n position: absolute;\n top: 0;\n left: 0;\n bottom: 0;\n right: 0;\n background: rgba(0, 0, 0, 0);\n transition: background 0.1s ease-in-out;\n }\n\n &:hover {\n &::after {\n background: rgba(0, 0, 0, 0.5);\n color: white;\n }\n }\n\n @media (max-width: 500px) {\n height: 50px;\n width: 50px;\n &::after {\n font-size: 0.6rem;\n }\n }\n"])));
|
|
6999
7137
|
|
|
7000
7138
|
//
|
|
@@ -7029,11 +7167,77 @@ var SKY_STYLE = {
|
|
|
7029
7167
|
'fog-ground-blend': 0.5,
|
|
7030
7168
|
'atmosphere-blend': ['interpolate', ['linear'], ['zoom'], 0, 1, 10, 1, 12, 0]
|
|
7031
7169
|
};
|
|
7032
|
-
|
|
7033
|
-
|
|
7034
|
-
|
|
7035
|
-
|
|
7036
|
-
|
|
7170
|
+
|
|
7171
|
+
//
|
|
7172
|
+
// TODO: review, this is clearly not a structured way
|
|
7173
|
+
// of doing this
|
|
7174
|
+
//
|
|
7175
|
+
function HoverLegend(_ref) {
|
|
7176
|
+
var layerId = _ref.layerId,
|
|
7177
|
+
__filterFeaturesForStep = _ref.__filterFeaturesForStep,
|
|
7178
|
+
legendProps = _objectWithoutProperties(_ref, _excluded);
|
|
7179
|
+
var mapRef = useMap();
|
|
7180
|
+
var SEQUENTIAL_COLOR_LEGEND_PROPS = useMemo(function () {
|
|
7181
|
+
var onMouseEnterStep = function onMouseEnterStep(stepInfo) {
|
|
7182
|
+
var _mapRef$current;
|
|
7183
|
+
var map = (_mapRef$current = mapRef.current) === null || _mapRef$current === void 0 ? void 0 : _mapRef$current.getMap();
|
|
7184
|
+
if (!map) {
|
|
7185
|
+
return;
|
|
7186
|
+
}
|
|
7187
|
+
var targetFeatures = __filterFeaturesForStep(stepInfo, map.queryRenderedFeatures(undefined, {
|
|
7188
|
+
layers: [layerId]
|
|
7189
|
+
}));
|
|
7190
|
+
var _iterator = _createForOfIteratorHelper(targetFeatures),
|
|
7191
|
+
_step;
|
|
7192
|
+
try {
|
|
7193
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
7194
|
+
var feature = _step.value;
|
|
7195
|
+
map.setFeatureState(feature, {
|
|
7196
|
+
hover: true
|
|
7197
|
+
});
|
|
7198
|
+
}
|
|
7199
|
+
} catch (err) {
|
|
7200
|
+
_iterator.e(err);
|
|
7201
|
+
} finally {
|
|
7202
|
+
_iterator.f();
|
|
7203
|
+
}
|
|
7204
|
+
};
|
|
7205
|
+
var onMouseLeaveStep = function onMouseLeaveStep() {
|
|
7206
|
+
var _mapRef$current2;
|
|
7207
|
+
var map = (_mapRef$current2 = mapRef.current) === null || _mapRef$current2 === void 0 ? void 0 : _mapRef$current2.getMap();
|
|
7208
|
+
if (!map) {
|
|
7209
|
+
return;
|
|
7210
|
+
}
|
|
7211
|
+
var layerRenderedFeatures = map.queryRenderedFeatures(undefined, {
|
|
7212
|
+
layers: [layerId]
|
|
7213
|
+
});
|
|
7214
|
+
var _iterator2 = _createForOfIteratorHelper(layerRenderedFeatures),
|
|
7215
|
+
_step2;
|
|
7216
|
+
try {
|
|
7217
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
7218
|
+
var feature = _step2.value;
|
|
7219
|
+
map.setFeatureState(feature, {
|
|
7220
|
+
hover: false
|
|
7221
|
+
});
|
|
7222
|
+
}
|
|
7223
|
+
} catch (err) {
|
|
7224
|
+
_iterator2.e(err);
|
|
7225
|
+
} finally {
|
|
7226
|
+
_iterator2.f();
|
|
7227
|
+
}
|
|
7228
|
+
};
|
|
7229
|
+
return {
|
|
7230
|
+
onMouseEnterStep: onMouseEnterStep,
|
|
7231
|
+
onMouseLeaveStep: onMouseLeaveStep
|
|
7232
|
+
};
|
|
7233
|
+
}, []);
|
|
7234
|
+
return /*#__PURE__*/React.createElement(Legend, _extends({}, legendProps, legendProps.type === 'SequentialColorLegend' ? SEQUENTIAL_COLOR_LEGEND_PROPS : {}));
|
|
7235
|
+
}
|
|
7236
|
+
function GeoReDUSInner(_ref2) {
|
|
7237
|
+
var globalState = _ref2.state,
|
|
7238
|
+
onSetGlobalState = _ref2.onSetState,
|
|
7239
|
+
api = _ref2.api,
|
|
7240
|
+
viewSpecs = _ref2.viewSpecs;
|
|
7037
7241
|
var METADATA_API_ENDPOINT = api.METADATA_API_ENDPOINT,
|
|
7038
7242
|
VECTOR_TILE_SERVER_ENDPOINT = api.VECTOR_TILE_SERVER_ENDPOINT;
|
|
7039
7243
|
|
|
@@ -7158,7 +7362,7 @@ function GeoReDUSInner(_ref) {
|
|
|
7158
7362
|
// Otherwise, return the first list, in order to ensure at least
|
|
7159
7363
|
// empty map rendering
|
|
7160
7364
|
//
|
|
7161
|
-
[viewConfState.layout[0]]).map(function (list) {
|
|
7365
|
+
[viewConfState.layout[0]]).map(function (list, index) {
|
|
7162
7366
|
var views = list.items.map(function (item) {
|
|
7163
7367
|
return resolvedViewsById[item.id];
|
|
7164
7368
|
}).filter(Boolean);
|
|
@@ -7240,7 +7444,7 @@ function GeoReDUSInner(_ref) {
|
|
|
7240
7444
|
METADATA_API_ENDPOINT: METADATA_API_ENDPOINT,
|
|
7241
7445
|
coordinates: null
|
|
7242
7446
|
}).then(/*#__PURE__*/function () {
|
|
7243
|
-
var
|
|
7447
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolvedMunicipioId) {
|
|
7244
7448
|
var selectedMunicipioId;
|
|
7245
7449
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
7246
7450
|
while (1) switch (_context3.prev = _context3.next) {
|
|
@@ -7282,7 +7486,7 @@ function GeoReDUSInner(_ref) {
|
|
|
7282
7486
|
}, _callee3);
|
|
7283
7487
|
}));
|
|
7284
7488
|
return function (_x5) {
|
|
7285
|
-
return
|
|
7489
|
+
return _ref4.apply(this, arguments);
|
|
7286
7490
|
};
|
|
7287
7491
|
}());
|
|
7288
7492
|
}
|
|
@@ -7320,8 +7524,8 @@ function GeoReDUSInner(_ref) {
|
|
|
7320
7524
|
//
|
|
7321
7525
|
// Remove features with no associated view
|
|
7322
7526
|
//
|
|
7323
|
-
.filter(function (
|
|
7324
|
-
var mapView =
|
|
7527
|
+
.filter(function (_ref5) {
|
|
7528
|
+
var mapView = _ref5.mapView;
|
|
7325
7529
|
return Boolean(mapView);
|
|
7326
7530
|
});
|
|
7327
7531
|
if (interactiveFeatures.length > 0) {
|
|
@@ -7344,6 +7548,12 @@ function GeoReDUSInner(_ref) {
|
|
|
7344
7548
|
return null;
|
|
7345
7549
|
}
|
|
7346
7550
|
}, []);
|
|
7551
|
+
var mapStyle = useMapStyle(baseMapStyle === 'satellite' ? SATELLITE_MAP_STYLE_URL : DATAVIZ_MAP_STYLE_URL, function (styleBase) {
|
|
7552
|
+
return _objectSpread2(_objectSpread2({}, styleBase), {}, {
|
|
7553
|
+
glyphs: GLYPHS_URL,
|
|
7554
|
+
sprite: 'https://api.maptiler.com/maps/dataviz/sprite'
|
|
7555
|
+
});
|
|
7556
|
+
});
|
|
7347
7557
|
return /*#__PURE__*/React.createElement(Flex, null, /*#__PURE__*/React.createElement(LeftPanel, {
|
|
7348
7558
|
open: leftPanelOpen,
|
|
7349
7559
|
onSetOpen: setLeftPanelOpen,
|
|
@@ -7374,7 +7584,7 @@ function GeoReDUSInner(_ref) {
|
|
|
7374
7584
|
schema: MUNICIPIO_ID_SELECTOR_SCHEMA,
|
|
7375
7585
|
value: municipioId,
|
|
7376
7586
|
onSetValue: setMunicipioId
|
|
7377
|
-
}))), /*#__PURE__*/React.createElement(SyncedMaps, {
|
|
7587
|
+
}))), mapStyle && /*#__PURE__*/React.createElement(SyncedMaps, {
|
|
7378
7588
|
maxPitch: 80,
|
|
7379
7589
|
onDrag: function onDrag() {
|
|
7380
7590
|
if (resolvedLayout.length > 1 && leftPanelOpen) {
|
|
@@ -7387,7 +7597,7 @@ function GeoReDUSInner(_ref) {
|
|
|
7387
7597
|
},
|
|
7388
7598
|
ref: syncedMapsRef,
|
|
7389
7599
|
onLoad: (/*#__PURE__*/function () {
|
|
7390
|
-
var
|
|
7600
|
+
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(event) {
|
|
7391
7601
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
7392
7602
|
while (1) switch (_context4.prev = _context4.next) {
|
|
7393
7603
|
case 0:
|
|
@@ -7399,7 +7609,7 @@ function GeoReDUSInner(_ref) {
|
|
|
7399
7609
|
}, _callee4);
|
|
7400
7610
|
}));
|
|
7401
7611
|
return function (_x6) {
|
|
7402
|
-
return
|
|
7612
|
+
return _ref6.apply(this, arguments);
|
|
7403
7613
|
};
|
|
7404
7614
|
}()),
|
|
7405
7615
|
attributionControl: false,
|
|
@@ -7412,13 +7622,13 @@ function GeoReDUSInner(_ref) {
|
|
|
7412
7622
|
right: 0
|
|
7413
7623
|
},
|
|
7414
7624
|
setPrefetchZoomDelta: 0,
|
|
7415
|
-
mapStyle:
|
|
7625
|
+
mapStyle: mapStyle,
|
|
7416
7626
|
sky: SKY_STYLE,
|
|
7417
7627
|
tooltip: getTooltip,
|
|
7418
|
-
maps: resolvedLayout.map(function (
|
|
7419
|
-
var id =
|
|
7420
|
-
views =
|
|
7421
|
-
legends =
|
|
7628
|
+
maps: resolvedLayout.map(function (_ref7, index) {
|
|
7629
|
+
var id = _ref7.id,
|
|
7630
|
+
views = _ref7.views,
|
|
7631
|
+
legends = _ref7.legends;
|
|
7422
7632
|
return {
|
|
7423
7633
|
id: id,
|
|
7424
7634
|
views: views,
|
|
@@ -7461,7 +7671,7 @@ function GeoReDUSInner(_ref) {
|
|
|
7461
7671
|
columns: legends.length > 1 ? 2 : 1,
|
|
7462
7672
|
gap: "10px"
|
|
7463
7673
|
}, legends.map(function (legend) {
|
|
7464
|
-
return /*#__PURE__*/React.createElement(
|
|
7674
|
+
return /*#__PURE__*/React.createElement(HoverLegend, _extends({}, resolvedLayout.length > 1 ? {
|
|
7465
7675
|
direction: 'row',
|
|
7466
7676
|
maxWidth: '300px',
|
|
7467
7677
|
size: '1'
|