3131```
3232const factory = new MapEmbeddableFactory();
3333const input = {
34- layerList: [], // where layerList is same as saved object layerListJSON property (unstringified)
35- title: 'my map',
3634 hideFilterActions: true,
3735 isLayerTOCOpen: false,
3836 openTOCDetails: ['tfi3f', 'edh66'],
3937 mapCenter: { lat: 0.0, lon: 0.0, zoom: 7 }
4038}
4139const mapEmbeddable = await factory.create(input, parent);
40+ // where layerList is same as saved object layerListJSON property (unstringified))
41+ mapEmbeddable.setLayerList([]);
4242```
4343
4444#### Customize tooltip
@@ -61,6 +61,7 @@ const renderTooltipContent = ({ addFilters, closeTooltip, features, isLocked, lo
6161}
6262
6363const mapEmbeddable = await factory.create(input, parent)
64+ mapEmbeddable.setLayerList(layerList);
6465mapEmbeddable.setRenderTooltipContent(renderTooltipContent);
6566```
6667
@@ -80,6 +81,7 @@ const eventHandlers = {
8081}
8182
8283const mapEmbeddable = await factory.create(input, parent);
84+ mapEmbeddable.setLayerList(layerList);
8385mapEmbeddable.setRenderTooltipContent(renderTooltipContent);
8486mapEmbeddable.setEventHandlers(eventHandlers);
8587```
@@ -92,46 +94,6 @@ Geojson sources will not update unless you modify `__featureCollection` property
9294```
9395const factory = new MapEmbeddableFactory();
9496const input = {
95- layerList: [
96- {
97- 'id': 'gaxya',
98- 'label': 'My geospatial data',
99- 'minZoom': 0,
100- 'maxZoom': 24,
101- 'alpha': 1,
102- 'sourceDescriptor': {
103- 'id': 'b7486',
104- 'type': 'GEOJSON_FILE',
105- '__featureCollection': {
106- "type": "FeatureCollection",
107- "features": [
108- {
109- "type": "Feature",
110- "geometry": {
111- "type": "Polygon",
112- "coordinates": [
113- [
114- [0, 0], [10, 10], [10, 0], [0, 0]
115- ]
116- ]
117- },
118- "properties": {
119- "name": "null island",
120- "another_prop": "something else interesting"
121- }
122- }
123- ]
124- }
125- },
126- 'visible': true,
127- 'style': {
128- 'type': 'VECTOR',
129- 'properties': {}
130- },
131- 'type': 'VECTOR'
132- }
133- ],
134- title: 'my map',
13597 hideFilterActions: true,
13698 isLayerTOCOpen: false,
13799 openTOCDetails: ['tfi3f', 'edh66'],
0 commit comments