Geoportal Extension for OpenLayers
API Reference

Module: Catalog

module:~controls/Catalog

Example

import Catalog from "gpf-ext-ol/controls/Catalog"
ou
import { Catalog } from "gpf-ext-ol"

var widget = new Catalog({
          collapsed : true,
          draggable : false,
          titlePrimary : "",
          titleSecondary : "Gérer vos couches de données",
          layerLabel : "title",
          layerFilter : [],
          search : {
              display : true,
              criteria : [
                  "name",
                  "title",
                  "description"
              ]
          },
          addToMap : true,
          categories : [
              {
                  title : "Données",
                  id : "data",
                  default : true,
                  filter : null
                  // sous categories
                  // items : [
                  //     {
                  //         title : "",
                  //         default : true,
                  //         filter : {
                  //             field : "",
                  //             value : ""
                  //         }
                  //     }
                  // ]
              }
          ],
          configuration : {
              type : "json", // type:"service"
              urls : [ // data:{}
                  "https://raw.githubusercontent.com/IGNF/cartes.gouv.fr-entree-carto/main/public/data/layers.json",
                  "https://raw.githubusercontent.com/IGNF/cartes.gouv.fr-entree-carto/main/public/data/edito.json"
              ]
          }
});
widget.on("catalog:loaded", (e) => { console.log(e.data); });
widget.on("catalog:layer:add", (e) => { console.log(e); });
widget.on("catalog:layer:remove", (e) => { console.log(e); });
map.addControl(widget);

Events

catalog:layer:add

Controls/Catalog/Catalog.js, line 994

event triggered when layer is added

Properties:
Name Type Description
type Object

event

name String

layer name

service String

service name

layer Object

layer conf

target Object

instance Catalog

Example
Catalog.on("catalog:layer:add", function (e) {
  console.log(e.layer);
})

catalog:layer:remove

Controls/Catalog/Catalog.js, line 1018

event triggered when layer is removed

Properties:
Name Type Description
type Object

event

name String

layer name

service String

service name

layer Object

layer conf

target Object

instance Catalog

Example
Catalog.on("catalog:layer:remove", function (e) {
  console.log(e.layer);
})

catalog:loaded

Controls/Catalog/Catalog.js, line 187

event triggered when data is loaded

Properties:
Name Type Description
type Object

event

data Object

data

target Object

instance Catalog

Example
Catalog.on("catalog:loaded", function (e) {
  console.log(e.data);
})