@eeacms/volto-eea-map 0.1.11 → 0.1.14

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.
Files changed (34) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/package.json +1 -1
  3. package/src/actionTypes.js +1 -0
  4. package/src/actions.js +1 -1
  5. package/src/components/Blocks/EEAMap/Edit.jsx +33 -2
  6. package/src/components/Blocks/EEAMap/Schema.js +7 -4
  7. package/src/components/Blocks/EEAMap/View.jsx +6 -5
  8. package/src/components/Blocks/EmbedEEAMap/Edit.jsx +36 -4
  9. package/src/components/Blocks/EmbedEEAMap/Schema.js +16 -5
  10. package/src/components/Blocks/EmbedEEAMap/View.jsx +75 -11
  11. package/src/components/ExtraViews.jsx +85 -0
  12. package/src/components/{Blocks/EEAMap/components/Webmap.jsx → Webmap.jsx} +33 -31
  13. package/src/components/index.js +6 -6
  14. package/src/components/visualization/VisualizationEditorWidget.jsx +120 -0
  15. package/src/components/{Blocks/EEAMap/components/widgets → visualization}/VisualizationView.jsx +0 -0
  16. package/src/components/{Blocks/EEAMap/components/widgets → visualization}/panelsSchema.js +0 -1
  17. package/src/components/widgets/DataQueryWidget.jsx +50 -0
  18. package/src/components/{Blocks/EEAMap/components/widgets → widgets}/LayerSelectWidget.jsx +169 -51
  19. package/src/components/{Blocks/EEAMap/components/widgets/LayersPanel.jsx → widgets/LayersPanelWidget.jsx} +2 -2
  20. package/src/components/{Blocks/EEAMap/components/widgets → widgets}/LegendWidget.jsx +45 -31
  21. package/src/components/{Blocks/EEAMap/components/widgets → widgets}/MapEditorWidget.jsx +1 -1
  22. package/src/components/{Blocks/EEAMap/components/widgets → widgets}/ObjectTypesWidget.jsx +11 -3
  23. package/src/components/widgets/panelsSchema.js +151 -0
  24. package/src/constants.js +29 -1
  25. package/src/index.js +42 -40
  26. package/src/middlewares/index.js +1 -1
  27. package/src/reducers/map_visualizations.js +1 -1
  28. package/src/static/code-line.svg +1 -0
  29. package/src/{components/Blocks/EEAMap/styles → styles}/map.css +64 -5
  30. package/src/{components/Blocks/EEAMap/utils.js → utils.js} +18 -2
  31. package/src/components/Blocks/EEAMap/components/widgets/ExtraViews.jsx +0 -86
  32. package/src/components/Blocks/EEAMap/components/widgets/VisualizationEditorWidget.jsx +0 -94
  33. package/src/components/Blocks/EEAMap/constants.js +0 -29
  34. package/src/components/Blocks/EmbedEEAMap/styles/map.css +0 -22
package/CHANGELOG.md CHANGED
@@ -4,8 +4,41 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
+ #### [0.1.14](https://github.com/eea/volto-eea-map/compare/0.1.13...0.1.14)
8
+
9
+ - new sources styles, icons from remixicon [`c9cca2a`](https://github.com/eea/volto-eea-map/commit/c9cca2a5e41322cfdeca1865b47a1892514c1cfc)
10
+ - reorganize & clean [`a902b89`](https://github.com/eea/volto-eea-map/commit/a902b8945389b19b388e85e00066b2c46a9e1a2e)
11
+ - Layer widget improvements [`99abe57`](https://github.com/eea/volto-eea-map/commit/99abe5722590719ac7e640de44a69ee19fcecfdf)
12
+ - Change data queries cards [`8d3c742`](https://github.com/eea/volto-eea-map/commit/8d3c74239f62782737108c25e84683239e6ab12f)
13
+ - Set default settings [`2c26f57`](https://github.com/eea/volto-eea-map/commit/2c26f571618d289158c7d32fd9814edcd29a7c60)
14
+ - Add description to layer [`cccfd59`](https://github.com/eea/volto-eea-map/commit/cccfd598060c4228215a5add1da3e159312966b2)
15
+ - only embed viz for now [`6bb7daf`](https://github.com/eea/volto-eea-map/commit/6bb7daf458a47bd185870ec3627a542f8ba715bc)
16
+ - Visualization improvements [`2a77f8b`](https://github.com/eea/volto-eea-map/commit/2a77f8bba1f6fd840d41043ee41b1b3bd23807f3)
17
+ - Cleanup [`6d6ceb9`](https://github.com/eea/volto-eea-map/commit/6d6ceb99768ff477a727cf217e48099e6f2d1a59)
18
+ - Add all query parameters with all values [`2f8c617`](https://github.com/eea/volto-eea-map/commit/2f8c61711154953ec25e20614b4ad96ed2bf592b)
19
+ - Data query widget visual improvements [`7eb3144`](https://github.com/eea/volto-eea-map/commit/7eb3144ad58a839ccc96f22d58a441b245893ea7)
20
+ - Data query widget more responsive to changes [`bb86329`](https://github.com/eea/volto-eea-map/commit/bb863299d51627a28f02e2cda133fc0e3bf9ebe9)
21
+
22
+ #### [0.1.13](https://github.com/eea/volto-eea-map/compare/0.1.12...0.1.13)
23
+
24
+ > 22 August 2022
25
+
26
+ - Enable Embed EEA map access to data_query [`#13`](https://github.com/eea/volto-eea-map/pull/13)
27
+ - update embed map with data_query [`719c007`](https://github.com/eea/volto-eea-map/commit/719c00776dff7ba63bbd57761a2c86ec5345a911)
28
+
29
+ #### [0.1.12](https://github.com/eea/volto-eea-map/compare/0.1.11...0.1.12)
30
+
31
+ > 22 August 2022
32
+
33
+ - Develop [`#12`](https://github.com/eea/volto-eea-map/pull/12)
34
+ - cleanup [`53a2d89`](https://github.com/eea/volto-eea-map/commit/53a2d897675af2f75d8bd787ed07cdcfac69bdd0)
35
+ - get criteria and map it as query on fresh layers [`51f8087`](https://github.com/eea/volto-eea-map/commit/51f80870764d65140ac0a6408c01c0b63476bbd2)
36
+
7
37
  #### [0.1.11](https://github.com/eea/volto-eea-map/compare/0.1.10...0.1.11)
8
38
 
39
+ > 18 August 2022
40
+
41
+ - Legend for each layer in object list [`#11`](https://github.com/eea/volto-eea-map/pull/11)
9
42
  - Legend for all layers [`2d9285e`](https://github.com/eea/volto-eea-map/commit/2d9285e12ea512b7a1f24300ad2f7b3072e334d5)
10
43
 
11
44
  #### [0.1.10](https://github.com/eea/volto-eea-map/compare/0.1.9...0.1.10)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-eea-map",
3
- "version": "0.1.11",
3
+ "version": "0.1.14",
4
4
  "description": "@eeacms/volto-eea-map: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -0,0 +1 @@
1
+ export const GET_MAP_VISUALIZATION = 'GET_MAP_VISUALIZATION';
package/src/actions.js CHANGED
@@ -1,4 +1,4 @@
1
- import { GET_MAP_VISUALIZATION } from './constants';
1
+ import { GET_MAP_VISUALIZATION } from './actionTypes';
2
2
 
3
3
  export function getVisualization(path) {
4
4
  return {
@@ -1,15 +1,35 @@
1
1
  import React from 'react';
2
+
3
+ import { connect } from 'react-redux';
4
+ import { compose } from 'redux';
5
+
2
6
  import { SidebarPortal } from '@plone/volto/components';
3
7
  import BlockDataForm from '@plone/volto/components/manage/Form/BlockDataForm';
8
+
4
9
  import { Schema } from './Schema';
5
10
  import View from './View';
11
+ import { getContent } from '@plone/volto/actions';
12
+
6
13
  import { addPrivacyProtectionToSchema } from '@eeacms/volto-embed';
7
- import './styles/map.css';
14
+ import '../../../styles/map.css';
8
15
 
9
16
  const Edit = (props) => {
10
17
  const { block, data, onChangeBlock, selected, id } = props;
11
18
  const schema = React.useMemo(() => Schema(props), [props]);
12
19
 
20
+ React.useEffect(() => {
21
+ if (
22
+ !data.data_query_params ||
23
+ props.data_query !== data.data_query_params
24
+ ) {
25
+ onChangeBlock(block, {
26
+ ...data,
27
+ data_query_params: props.data_query,
28
+ });
29
+ }
30
+ // eslint-disable-next-line react-hooks/exhaustive-deps
31
+ }, [props.data_query, block, data]);
32
+
13
33
  return (
14
34
  <div>
15
35
  <View data={data} id={id} />
@@ -31,4 +51,15 @@ const Edit = (props) => {
31
51
  );
32
52
  };
33
53
 
34
- export default Edit;
54
+ export default compose(
55
+ connect(
56
+ (state, props) => ({
57
+ data_query: state.content.data.data_query,
58
+ data_provenance:
59
+ state.content.subrequests?.[props.id]?.data?.data_provenance,
60
+ }),
61
+ {
62
+ getContent,
63
+ },
64
+ ),
65
+ )(Edit);
@@ -13,6 +13,7 @@ export const Schema = (props) => {
13
13
  'show_download',
14
14
  'show_viewer',
15
15
  'show_sources',
16
+ 'data_query_params',
16
17
  ],
17
18
  },
18
19
  ],
@@ -38,14 +39,16 @@ export const Schema = (props) => {
38
39
  title: 'Show legend',
39
40
  type: 'boolean',
40
41
  },
41
- show_download: {
42
- title: 'Show download',
43
- type: 'boolean',
44
- },
42
+
45
43
  show_viewer: {
46
44
  title: 'Show web viewer',
47
45
  type: 'boolean',
48
46
  },
47
+ data_query_params: {
48
+ title: 'Query parameters',
49
+ description: 'ddafdfas',
50
+ widget: 'data_query_widget',
51
+ },
49
52
  },
50
53
  required: [],
51
54
  };
@@ -3,17 +3,17 @@ import React from 'react';
3
3
  import { connect } from 'react-redux';
4
4
  import { compose } from 'redux';
5
5
 
6
- import Webmap from './components/Webmap';
7
- import ExtraViews from './components/widgets/ExtraViews';
6
+ import Webmap from '../../Webmap';
7
+ import ExtraViews from '../../ExtraViews';
8
+
8
9
  import { PrivacyProtection } from '@eeacms/volto-embed';
9
10
  import { getContent } from '@plone/volto/actions';
10
11
 
11
12
  const View = (props) => {
12
- const { data, id, path, data_provenance } = props || {};
13
+ const { data, id, path } = props || {};
13
14
  const { map_data = {}, height = '' } = data;
14
15
 
15
16
  React.useEffect(() => {
16
- // get content from document
17
17
  if (path) {
18
18
  props.getContent(path, null, id);
19
19
  }
@@ -24,7 +24,7 @@ const View = (props) => {
24
24
  <div>
25
25
  <PrivacyProtection data={data} {...props}>
26
26
  <Webmap data={map_data} height={height} id={id} />
27
- <ExtraViews data={{ ...data, data_provenance }} />
27
+ <ExtraViews data={data} />
28
28
  </PrivacyProtection>
29
29
  </div>
30
30
  );
@@ -33,6 +33,7 @@ const View = (props) => {
33
33
  export default compose(
34
34
  connect(
35
35
  (state, props) => ({
36
+ data_query: state.content.subrequests?.[props.id]?.data?.data_query,
36
37
  data_provenance:
37
38
  state.content.subrequests?.[props.id]?.data?.data_provenance,
38
39
  }),
@@ -1,18 +1,39 @@
1
1
  import React from 'react';
2
2
  import { SidebarPortal } from '@plone/volto/components';
3
+
4
+ import { connect } from 'react-redux';
5
+ import { compose } from 'redux';
6
+
7
+ import { getContent } from '@plone/volto/actions';
8
+
3
9
  import BlockDataForm from '@plone/volto/components/manage/Form/BlockDataForm';
4
- import { Schema } from './Schema';
5
10
  import View from './View';
11
+ import { Schema } from './Schema';
6
12
  import { addPrivacyProtectionToSchema } from '@eeacms/volto-embed';
7
- import './styles/map.css';
13
+ import '../../../styles/map.css';
8
14
 
9
15
  const Edit = (props) => {
10
16
  const { block, data, onChangeBlock, selected, id } = props;
11
17
  const schema = React.useMemo(() => Schema(props), [props]);
12
18
 
19
+ React.useEffect(() => {
20
+ props.getContent(data.vis_url, null, id);
21
+ // eslint-disable-next-line react-hooks/exhaustive-deps
22
+ }, [data.vis_url]);
23
+ React.useEffect(() => {
24
+ const diffParams = props.data_query !== data.data_query_params;
25
+ if (diffParams || !data.data_query_params) {
26
+ onChangeBlock(block, {
27
+ ...data,
28
+ data_query_params: props.data_query,
29
+ });
30
+ }
31
+ // eslint-disable-next-line react-hooks/exhaustive-deps
32
+ }, [props.data_query, block, data]);
33
+
13
34
  return (
14
35
  <div>
15
- <View data={data} id={id} />
36
+ <View data={data} id={id} isEdit={true} />
16
37
  <SidebarPortal selected={selected}>
17
38
  <BlockDataForm
18
39
  block={block}
@@ -31,4 +52,15 @@ const Edit = (props) => {
31
52
  );
32
53
  };
33
54
 
34
- export default Edit;
55
+ export default compose(
56
+ connect(
57
+ (state, props) => ({
58
+ data_query: state.content.data.data_query,
59
+ data_provenance:
60
+ state.content.subrequests?.[props.id]?.data?.data_provenance,
61
+ }),
62
+ {
63
+ getContent,
64
+ },
65
+ ),
66
+ )(Edit);
@@ -10,9 +10,10 @@ export const Schema = (props) => {
10
10
  'description',
11
11
  'height',
12
12
  'show_legend',
13
- 'show_download',
14
13
  'show_viewer',
15
14
  'show_sources',
15
+ 'enable_queries',
16
+ ...(props.data.enable_queries ? ['data_query_params'] : []),
16
17
  ],
17
18
  },
18
19
  ],
@@ -31,20 +32,30 @@ export const Schema = (props) => {
31
32
  },
32
33
  show_sources: {
33
34
  title: 'Show sources',
35
+ description: 'Will show sources set in this page Data provenance',
34
36
  type: 'boolean',
35
37
  },
36
38
  show_legend: {
37
39
  title: 'Show legend',
38
40
  type: 'boolean',
39
41
  },
40
- show_download: {
41
- title: 'Show download',
42
+ show_viewer: {
43
+ title: 'Show API link',
44
+ description: 'Open the map on ArcGIS js service',
42
45
  type: 'boolean',
43
46
  },
44
- show_viewer: {
45
- title: 'Show web viewer',
47
+ enable_queries: {
48
+ title: 'Enable queries',
49
+ description:
50
+ 'Will import Criteria from content-type and try to query map layer fields.',
46
51
  type: 'boolean',
47
52
  },
53
+ data_query_params: {
54
+ title: 'Query parameters',
55
+ description:
56
+ 'When using page level parameters to filter the map, please map those to the corresponding field name from the ArcGIS service',
57
+ widget: 'data_query_widget',
58
+ },
48
59
  },
49
60
  required: [],
50
61
  };
@@ -4,40 +4,99 @@ import { connect } from 'react-redux';
4
4
  import { compose } from 'redux';
5
5
 
6
6
  import { PrivacyProtection } from '@eeacms/volto-embed';
7
- import Webmap from '../EEAMap/components/Webmap';
8
- import ExtraViews from '../EEAMap/components/widgets/ExtraViews';
7
+
9
8
  import { getContent } from '@plone/volto/actions';
9
+ import { getVisualization } from '../../../actions';
10
+ import Webmap from '../../Webmap';
11
+ import ExtraViews from '../../ExtraViews';
10
12
 
11
13
  const View = (props) => {
12
- const { data, viz_content = {}, id } = props || {};
13
- const { height = '', vis_url = '' } = data;
14
+ const { data, viz_content = {}, id, isEdit, map_visualization } = props || {};
15
+ const { height = '', vis_url = '', enable_queries } = data;
16
+
17
+ const { data_provenance = {} } = viz_content || {};
14
18
 
15
- const { map_visualization_data = '', data_provenance = {} } =
16
- viz_content || {};
19
+ const [mapData, setMapData] = React.useState(map_visualization);
17
20
 
18
21
  React.useEffect(() => {
19
22
  if (vis_url) {
20
23
  props.getContent(vis_url, null, id);
24
+ props.getVisualization(vis_url);
21
25
  }
22
26
  // eslint-disable-next-line react-hooks/exhaustive-deps
23
- }, [vis_url]);
27
+ }, [vis_url, enable_queries]);
28
+
29
+ React.useEffect(() => {
30
+ const query_params = isEdit
31
+ ? props.data.data_query_params
32
+ : props.data_query;
33
+ var altMapData = { ...map_visualization };
34
+
35
+ if (
36
+ enable_queries &&
37
+ query_params &&
38
+ query_params.length > 0 &&
39
+ altMapData.layers &&
40
+ altMapData.layers.map_layers &&
41
+ altMapData.layers.map_layers.length > 0
42
+ ) {
43
+ let rules = [];
44
+ altMapData.layers.map_layers.forEach((l, j) => {
45
+ query_params.forEach((param, i) => {
46
+ const matchingFields =
47
+ l.map_layer && l.map_layer.fields && l.map_layer.fields.length > 0
48
+ ? l.map_layer.fields.filter(
49
+ (field, k) =>
50
+ field.name === param.alias || field.name === param.i,
51
+ )
52
+ : [];
53
+
54
+ matchingFields.forEach((m, i) => {
55
+ const newRules = param.v
56
+ ? param.v.map((paramVal, i) => {
57
+ return {
58
+ field: m.name,
59
+ operator: '=',
60
+ value: paramVal,
61
+ };
62
+ })
63
+ : [];
64
+ rules = rules.concat(newRules);
65
+ });
66
+ });
67
+ let autoQuery = {
68
+ combinator: 'or',
69
+ rules,
70
+ };
71
+ altMapData.layers.map_layers[j].map_layer.query = autoQuery;
72
+ });
73
+ }
74
+ setMapData(altMapData);
75
+ }, [
76
+ map_visualization,
77
+ props.data,
78
+ props.data_query,
79
+ viz_content,
80
+ isEdit,
81
+ enable_queries,
82
+ ]);
24
83
 
25
84
  return (
26
85
  <div>
27
86
  <PrivacyProtection data={data} {...props}>
28
- {map_visualization_data && (
87
+ {mapData && (
29
88
  <div>
30
- <Webmap data={map_visualization_data} height={height} />
89
+ <Webmap data={mapData} height={height} />
31
90
  <ExtraViews
32
91
  data={{
33
92
  ...data,
34
93
  data_provenance,
35
- map_data: map_visualization_data,
94
+ map_data: map_visualization,
36
95
  }}
37
96
  />
38
97
  </div>
39
98
  )}
40
- {!map_visualization_data && (
99
+ {!mapData && (
41
100
  <p>No map view to show. Set visualization in block configuration.</p>
42
101
  )}
43
102
  </PrivacyProtection>
@@ -48,10 +107,15 @@ const View = (props) => {
48
107
  export default compose(
49
108
  connect(
50
109
  (state, props) => ({
110
+ data_query: state.content.data.data_query,
111
+ state,
112
+ map_visualization:
113
+ state.map_visualizations?.data[props.data.vis_url]?.data,
51
114
  viz_content: state.content.subrequests?.[props.id]?.data,
52
115
  }),
53
116
  {
54
117
  getContent,
118
+ getVisualization,
55
119
  },
56
120
  ),
57
121
  )(View);
@@ -0,0 +1,85 @@
1
+ import React from 'react';
2
+ import { Button } from 'semantic-ui-react';
3
+ import { UniversalLink } from '@plone/volto/components';
4
+
5
+ import LegendWidget from './widgets/LegendWidget';
6
+ import { serializeNodes } from 'volto-slate/editor/render';
7
+
8
+ import codeSVG from '../static/code-line.svg';
9
+
10
+ const ExtraViews = ({ data }) => {
11
+ const {
12
+ map_data = {},
13
+ description,
14
+ show_legend,
15
+ show_viewer,
16
+ show_sources,
17
+ data_provenance = {},
18
+ } = data;
19
+ return (
20
+ <div className="extra-eea-map-content">
21
+ {map_data && map_data.layers?.map_layers[0] && show_viewer && (
22
+ <div
23
+ style={{ display: 'flex', justifyContent: 'end', margin: '10px 0' }}
24
+ >
25
+ {show_viewer && (
26
+ <a
27
+ target="_blank"
28
+ rel="noreferrer"
29
+ href={
30
+ `https://www.arcgis.com/home/webmap/viewer.html?url=` +
31
+ `${map_data.layers.map_layers[0].map_layer.map_service_url}&source=sd`
32
+ }
33
+ >
34
+ <Button size="tiny">
35
+ <Button.Content>
36
+ <img
37
+ className="extra-view-external-button"
38
+ src={codeSVG}
39
+ alt=""
40
+ title="Show API link"
41
+ />
42
+ </Button.Content>
43
+ </Button>
44
+ </a>
45
+ )}
46
+ </div>
47
+ )}
48
+ {show_legend && map_data && <LegendWidget data={map_data} />}
49
+ {show_sources && (
50
+ <>
51
+ {data_provenance &&
52
+ data_provenance.data &&
53
+ data_provenance.data.length > 0 ? (
54
+ <div>
55
+ <h3>Sources:</h3>
56
+ <ul>
57
+ {data_provenance.data.map((param, i) => (
58
+ <li key={i}>
59
+ <div className="map_source_param_container">
60
+ <UniversalLink
61
+ className="map_source_title"
62
+ href={param.link}
63
+ >
64
+ {param.title}
65
+ </UniversalLink>
66
+ ,
67
+ <span className="map_source_description">
68
+ {param.organisation}
69
+ </span>
70
+ </div>
71
+ </li>
72
+ ))}
73
+ </ul>
74
+ </div>
75
+ ) : (
76
+ <p>Data provenance is not set for visualization used or page</p>
77
+ )}
78
+ </>
79
+ )}
80
+ {description && serializeNodes(description)}
81
+ </div>
82
+ );
83
+ };
84
+
85
+ export default ExtraViews;
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable */
2
2
  import React from 'react';
3
- import { withDeviceSize } from '@eeacms/volto-eea-map/hocs';
3
+ import { withDeviceSize } from '../hocs';
4
4
  import { loadModules } from 'esri-loader';
5
5
  import { formatQuery } from 'react-querybuilder';
6
6
 
@@ -20,8 +20,8 @@ const Webmap = (props) => {
20
20
  const { editMode, height, id } = props;
21
21
 
22
22
  const data = React.useMemo(() => props.data || {}, [props.data]);
23
- const device = React.useMemo(() => props.device || {}, [props.device]);
24
23
 
24
+ const device = React.useMemo(() => props.device || {}, [props.device]);
25
25
  const { base = {}, layers = {}, legend = {}, general = {} } = data;
26
26
 
27
27
  const { base_layer = '' } = base;
@@ -32,6 +32,7 @@ const Webmap = (props) => {
32
32
  layers.map_layers
33
33
  .filter(({ map_layer }) => map_layer)
34
34
  .map((l, i) => l.map_layer);
35
+
35
36
  const options = {
36
37
  css: true,
37
38
  };
@@ -86,34 +87,35 @@ const Webmap = (props) => {
86
87
  Zoom,
87
88
  } = modules;
88
89
  let layers =
89
- map_layers &&
90
- map_layers.length > 0 &&
91
- map_layers
92
- .filter(({ map_service_url, layer }) => map_service_url && layer)
93
- .map(({ map_service_url, layer, query = '' }) => {
94
- const url = `${map_service_url}/${layer}`;
95
- let mapLayer;
96
- switch (layer.type) {
97
- case 'Raster Layer':
98
- mapLayer = new MapImageLayer({
99
- url: map_service_url,
100
- });
101
- break;
102
- case 'Feature Layer':
103
- mapLayer = new FeatureLayer({
104
- url,
105
- definitionExpression: query ? formatQuery(query, 'sql') : '',
106
- });
107
- break;
108
- case 'Group Layer':
109
- mapLayer = new GroupLayer({ url });
110
- break;
111
- default:
112
- break;
113
- }
114
- return mapLayer;
115
- });
116
-
90
+ map_layers && map_layers.length > 0
91
+ ? map_layers
92
+ .filter(({ map_service_url, layer }) => map_service_url && layer)
93
+ .map(({ map_service_url, layer, query = '' }) => {
94
+ const url = `${map_service_url}/${layer}`;
95
+ let mapLayer;
96
+ switch (layer.type) {
97
+ case 'Raster Layer':
98
+ mapLayer = new MapImageLayer({
99
+ url: map_service_url,
100
+ });
101
+ break;
102
+ case 'Feature Layer':
103
+ mapLayer = new FeatureLayer({
104
+ url,
105
+ definitionExpression: query
106
+ ? formatQuery(query, 'sql')
107
+ : '',
108
+ });
109
+ break;
110
+ case 'Group Layer':
111
+ mapLayer = new GroupLayer({ url });
112
+ break;
113
+ default:
114
+ break;
115
+ }
116
+ return mapLayer;
117
+ })
118
+ : [];
117
119
  const map = new Map({
118
120
  basemap: base_layer || 'hybrid',
119
121
  layers,
@@ -193,7 +195,7 @@ const Webmap = (props) => {
193
195
  });
194
196
  }
195
197
  return { view, map };
196
- }, [modules, base_layer, map_layers, general, legend]);
198
+ }, [modules, data, data.layers, map_layers]);
197
199
 
198
200
  return (
199
201
  <div>
@@ -1,7 +1,7 @@
1
- import EEAMapView from './Blocks/EEAMap/View';
2
- import EEAMapEdit from './Blocks/EEAMap/Edit';
1
+ export EEAMapView from './Blocks/EEAMap/View';
2
+ export EEAMapEdit from './Blocks/EEAMap/Edit';
3
+ export Webmap from './Webmap';
4
+ export ExtraViews from './ExtraViews';
3
5
 
4
- import EmbedMapView from './Blocks/EmbedEEAMap/View';
5
- import EmbedMapEdit from './Blocks/EmbedEEAMap/Edit';
6
-
7
- export { EEAMapEdit, EEAMapView, EmbedMapView, EmbedMapEdit };
6
+ export EmbedMapView from './Blocks/EmbedEEAMap/View';
7
+ export EmbedMapEdit from './Blocks/EmbedEEAMap/Edit';