[GeoNetwork-users] Adding an ol3 Layer to the LayerManager

Hi list,

in my GN3 catalog the user can add various layers to the map by calling map.addLayer() function from the OpenLayers3 library.
Anyway, the new layer is displayed correct and I'd like to have the newly added layer to be displayed in the 'Manage Layers' overlay where the user can hide or show layers.

I guess that the LayerManager is populated by an array returned from map.getLayers().getArray(), as written in the LayerManagerDirective.js on line 74. The newly added layer is present when I call this function ( map.getLayers().getArray() ) in my code after the layer was added to the map. So the map has recognized the added layer.

So my question is: Is there a way to somehow force the LayerManager to refresh whenever a layer has been added to the map, just as when you add a layer via the 'Add Layer' overlay? Or has the layer to be some kind of a wms layer in order to be displayed in the LayerManager?

Kind regards,

Sebastian

Hi,

The layermanager is bound to the map layers collection, but it is filtered.
https://github.com/geonetwork/core-geonetwork/blob/develop/web-ui/src/main/resources/catalog/components/viewer/layermanager/partials/layermanager.html#L2

The filter function is in

So you might need to set layer.displayInLayerManager = true;

On Mon, Aug 3, 2015 at 3:44 PM, Sebastian Hübner <
sebastian.huebner@anonymised.com> wrote:

Hi list,

in my GN3 catalog the user can add various layers to the map by calling
map.addLayer() function from the OpenLayers3 library.
Anyway, the new layer is displayed correct and I'd like to have the
newly added layer to be displayed in the 'Manage Layers' overlay where
the user can hide or show layers.

I guess that the LayerManager is populated by an array returned from
map.getLayers().getArray(), as written in the LayerManagerDirective.js
on line 74. The newly added layer is present when I call this function (
map.getLayers().getArray() ) in my code after the layer was added to the
map. So the map has recognized the added layer.

So my question is: Is there a way to somehow force the LayerManager to
refresh whenever a layer has been added to the map, just as when you add
a layer via the 'Add Layer' overlay? Or has the layer to be some kind of
a wms layer in order to be displayed in the LayerManager?

Kind regards,

Sebastian

------------------------------------------------------------------------------
_______________________________________________
GeoNetwork-users mailing list
GeoNetwork-users@lists.sourceforge.net
geonetwork-users List Signup and Options
GeoNetwork OpenSource is maintained at
GeoNetwork - Geographic Metadata Catalog download | SourceForge.net

--
*camptocamp*
INNOVATIVE SOLUTIONS
BY OPEN SOURCE EXPERTS

*Florent Gravin*
0479444492