Skip to content
Tobia edited this page Feb 7, 2014 · 25 revisions

MapStore CKAN Extension

Overview

This extension provides the MapStore integration into the CKAN Data Portal. Two additional plugins are available in order to manage:

  • WMS preview using MapStore: This replaces the standard CKAN WMS Preview (data in CKAN wms format) allowing to show WMS resources inside the MapStore WebGIS. The WMS GetCapabilities URL must be provided with the layer name (including the workspace) as the name of the CKAN resource.

mapstore wms preview

  • GeoStore Harvesting: This plugin can be used in order to manage Harvest operations to GeoStore. New Datasets are created in CKAN and populated from the GeoStore's resources (basically the MapStore's maps).

MapStore Resource Dataset

In this case a new mapstore format in CKAN is used from the CKAN MapStore plugin in order to show manage and show the preview inside the MapStore WebGIS.

MapStore Preview

Installation

In order to install the ckanext-mapstore, copy (or clone using git) the ckanext-mapstore directory inside the CKAN src directory (i.e. ckan/default/src).

Before using the plugin, the extension must installed into the CKAN virtual environment:

  • activate the virtualenv
  • change to the CKAN’s directory
  • clone the extension repo
  • run setup.py
     $ . /usr/lib/ckan/default/bin/activate
     (default)$ cd /usr/lib/ckan/default/src
     (default)$ git clone https://github.com/geosolutions-it/ckanext-mapstore.git
     (default)$ cd ckanext-mapstore
     (default)$ python setup.py develop

MapStore Installation

In order to make available the preview through MapStore you have also to provide a standard MapStore installation running, as specified inside the MapStore WIKI.

Enabling the Plugins

The ckanext-mapstore is a common CKAN extension that can be enabled in your CKAN installation as usual editing the mySite.ini configuration file, as an instance:

ckan.plugins = stats pdf_preview harvest mapstore_preview geostore_harvester

In this case both plugins (mapstore_preview and geostore_harvester) are enabled. You have to restart your CKAN when done.

NOTE: The geostore_harvester extends the basic CKAN 'harvest', so this must be included if you want to us it.

Then you have to enable the custom MapStore CSS:

ckan.template_head_end = <link rel="stylesheet" href="/css/mapstore.css" type="text/css">

You should now be able to start CKAN in the development web server and have it start up without any problems:

 [ckan@localhost ~]$ paster serve /etc/ckan/default/development.ini
 Starting server in PID 13961.
 serving on 0.0.0.0:5000 view at http://127.0.0.1:5000`

Configuring the MapStore preview

The MapStorePlugin manages the formats below:

  • wms: Standard WMS resource
  • mapstore: Is used to manage MapStore's map previews for GeoStore harvested resources.

In general, the preview through the MapStore WebGIS, is managed in CKAN with an HTML iFrame; So the connections parametes to the MapStore instances must be specified. Please check/modify these inside the preview_config.js file:

 [ckan@localhost ~]$ cd /usr/lib/ckan/default/src/ckanext-mapstore
 [ckan@localhost ~]$ vim ckanext/mapstore/theme/public/preview_config.js

Below the configurations parameters to use:

 var preview_config = {
       viewerConfigName: "preview",
       viewerPath: "/viewer",
       composerPath: "/composer",
       mapStoreBaseURL: "http://localhost:8080/mapstore"
 }
  • viewerConfigName: The MapStore WebGIS configuration to use (see the MapStore WIKI for more details).
  • viewerPath: The relative URL of the MapStore viewer (used for the basic preview inside the CKAN resource page).
  • composerPath: The relative URL of the MapStore advanced viewer (used inside the CKAN preview page in order to open the advanced MapStore viewer in a separate browser page).
  • mapStoreBaseURL: The MapStore base URL.
Clone this wiki locally