Skip to content
François Prunayre edited this page Dec 5, 2016 · 14 revisions

API configuration

A new setting for the main app configuration is added. This setting is a JSON object that can be configured from the admin page. It defines how the main search application is.

Old UI settings are moved to that main app configuration. The list of old settings are:

  • map/isMapViewerEnabled
  • map/is3DModeAllowed
  • map/bingKey
  • map/isSaveMapInCatalogAllowed
  • map/proj4js
  • map/config
  • system/ui/defaultView

Check if needed:

  • metadata/editor/schemaConfig

Settings API change:

  • A new operation is added in order to collect the value of JSON node in a JSON setting. GET /api/settings/?node=config.download

Application configuration

The following configuration is used to configure the application.

// GeoNetwork JS API Configuration
var gnCfg = {
  mods: {
    // Search app
    search: {
      hitsPerPage: [10, 50, 100],
      sortBy: ['relevancy', 'title', 'changeDate'],
      minimap: {

      },
      filters: [
        {id: 'any', label: {fre: 'Recherche'}},
        {id: 'theme_wallon', label: {fre: 'Thèmes'}},
        {id: 'orgName', label: {fre: 'Propriétaires'}}
        ],
      // Filtre optionnel permettant de surcharger toutes
      // les recherches
      // filter: '',
      // Par exemple, filter: 'resourceType=maps', pour ne rechercher que des cartes
      tabs: 'resourceType',
      facets: ['inspireTheme', 'category']
    },
    // Application panier
    basket: {
      // http://geoportail.wallonie.be/mes-notifications-et-services
      // Les notifications enregistrent pour un utilisateur une liste d'UUIDs
      // Affiche une liste de fiche avec un filtrage rapide sur une facette
      // Notifie les utilisateurs lors de mise à jour des fiches
      notifications: {
        facets: ['resourceType']
      },
      // http://geoportail.wallonie.be/mes-notifications-et-services
      // Les préférées enregistrent pour un utilisateur une liste d'UUIDs
      // Cette liste s'affiche et permet de retrouver une fiche rapidement
      // Dans walonmap, elles ne portent que sur des services
      preferred: {
        filter: 'resourceType:service'
      },
      // http://geoportail.wallonie.be/sites/geoportail/geodata-donwload.html
      // L'extracteur prépare le téléchargement en demandant à l'utilisateur
      // de préciser ses besoins. Ces informations sont ensuite transmisent à
      // un outil d'extraction.
      download: {
        config: {
          formats: 'http://extractor.api.be/formats',
          // or an [{id: 'ESRI Shapefile', label: {fre: 'Fichier de formes'}]
          crs: 'http://extractor.api.be/crs',
          // or an [{id: 'EPSG:4326', label: {fre: 'WGS 84'}]
        },
        aoi: {
          type: ['communes', 'bbox']
        },
        license: {
          // Add form configuration
        },
        userDetails: {
          // Add user form info
        }
      }
    },
    // Map
    map: {
      synchWithMinimap: true|false
    }
  },
  // Define how to add to custom map app
  mapLinks: {
    wms: 'walonmap?uuid={{uuid}}&layerurl={{url}}&layer={{name}}'
  }
};

<!-- Main application container -->
<div ng-app="gn_app"
     ng-controller="GnCatController"
     ng-include="'../../catalog/views/myapp.html'"></div>

<!-- Chargement des librairies -->
<script src="http://localhost:8080/geonetwork/static/lib.js"></script>

This configuration is used in the GeoNetwork main app.

Build custom configuration

From the admin panel, catalog administrator can also create custom configuration for third party application. This page provides all the JS API settings and allows user to download the application configuration as JSON file.

Testing

A simple HTML page is created in order to test the JS API.

Clone this wiki locally