ISO/INSPIRE Metadata Support

From GRASS-Wiki
Revision as of 13:38, 14 August 2014 by Landa (talk | contribs) (remove duplicated template)

Jump to: navigation, search

ISO 19115:2003- Geographic information -- Metadata

ISO 19115:2003(ISO) defines the scheme required for describing geographic information and services. It provides information about the identification, the extent, the quality, the spatial and temporal scheme, spatial reference, and distribution of digital geographic data.more

About wx.metadata

New metadata management is currently available in GRASS add-ons. Package for creating and editing metadata according to EN ISO 19115, described here, consists of tree modules. Modules r.info.iso and v.info.iso are command line based and support conversion from current native metadata management (r.info, v.info) to ISO based metadata. GUI based module - g.gui.metadata offers advanced tools for management of metadata.

Wxmetadata-editing.png

Dependencies and installation

Dependencies

Current development of metadata management has dependence on external libraries:

  • OWSLib development version ()
git clone git://github.com/geopython/OWSLib.git
cd OWSLib && sudo python setup.py install
  • Jinja templates
git clone git://github.com/mitsuhiko/jinja2.git
cd jinja2 && sudo python setup.py install

Installation of metadata management

Currently the wx.metadata package is available in GRASS Add-ons.

GRASS> g.extension wx.metadata

Modules and usage

Naming of metadata files and storage

The metadata product fully supports XML Default location of exported metadata uses folder “metadata” in GRASS Location. In case the metadata file name is not changed, the name is build from prefix according to characteristic of maps. For raster maps prefix is derived from current nomenclature - 'cell' and for vector map – 'vector' by the same way. File name is derived from the the name of the map. Postfix-extension is '.xml'.

example: vector map - roads vector_roads.xml

Metadata profile

The metadata profile defines attributes, which can be editing in this editor. The editor offers the already mentioned two profiles(Basic and Inspire). Editor also support loading of customized profiles. See Creation of custom ISO based profile.

Modules r.info.iso and v.info.iso

Command line based modules implements conversion of native GRASS metadata to ISO based XML metadata files. Identical configuration applies for both modules. Products of these modules differs partly in certain metadata attributes related to differences between raster (r.info) and vector (v.info) maps metadata.

  • Currently are available two build-in ISO profile:

The Basic profile is substituted from intersection between GRASS native metadata and INSPIRE profile. The intersect includes all available GRASS metadata. Metadata which cannot be assigned to ISO based attributes are stored in metadata attribute - abstract. The Inspire profile fulfills the criteria of INSPIRE profile. The values which are not able to get from native GRASS metadata are filled by text string '$NULL'. This rule applies for both profiles.

Parameters of modules:

  • map - selection of map for metadata creation
  • profile - selection of metadata profile (basic and inspire)
  • output - path to output XML metadata file. Default = according to naming&storage rules

Module g.gui.metadata

Metadata editor (editor) includes graphical interface for conversion metadata from r.info and v.info to ISO based metadata, editing metadata files and creating metadata templates. In addition, the graphical module allows validating of INSPIRE and Basic profile.

Creation of metadata

Editor offers two editing modes. The first one allows to create metadata from selected GRASS maps from an active location. The second one allows editing of external metadata file.

GRASS metadata map editor

Wxmetadata-mapEdit.png

Combo box for selection of ISO profile:

  • basic
  • inspire
  • load custom – this option allows to load metadata profile from file. For example in case of use of predefining template. With this selection the editor make intersection of GRASS Basic profile(all available metadata for selected map) and loaded custom profile.


External metadata editor

150

In this case to load metadata profile file and metadata file is necessary for editing. This option does not support any connection with GRASS maps metadata. Of course, is possible to load exported metadata from the past.

Defining templates

This function allows to create pattern of metadata profile. In other words it support defining values of attributes which will be same for selected maps. Direct link on this function is multiple editing mode (see below).

Wxmetadata-template.png

Usage

  • If check-box of metadata attribute is checked, the OWSLib object in template will be replaced by value. Unchecked attributes will not change this 'part' of the template.

example: Result of checked attribute in template

    <gmd:dateStamp>
        <gco:Date>2013-01-01</gco:Date>
    </gmd:dateStamp>

example: Result of unchecked attribute in template

    <gmd:dateStamp>
        <gco:Date>{{ md.datestamp }}{# tag="md.datestamp" , name="Metadata date" ,\
 ref= "Part B 10.2" , desc= "Date that the metadata was created.",type = "date" ,
 example = "2005-03-27" , multi= 0 , group= "Metadata" , multiline= False #}</gco:Date>
    </gmd:dateStamp>
  • The yellow background of text fields indicates metadata attributes, which are not possible parsed from GRASS map information.

Editing metadata of multiple map selection

Advantages of this editing mode is in work using of defined template. This option can be used by selection of multiple maps in data catalog.

Validation of metadata profile

On the right side of editor there is a validator of metadata. Currently, validator is able to validate two build-in profiles. For selection of profile “Load custom” is set by default in the inspire profile.

Creation of custom ISO based profile

Creation of own custom ISO based profile is with using Jinja template syntax and some addition rules. The main item of template is composite from two braces. Both of them are fully according to syntax of Jinja template. First holds information about statements of loop or condition and also simple Python object. Second braces according to Jinja template syntax is represented by comment {# #}. In this braces are stored additional information for generating graphical interface of editor. In addition also includes information about individual metadata attributes (name, example, description, multiplicity, etc).

The first braces

Contain object of OWSLib which holds the metadata value. This values can be object which is describing single variable or list of variables. Value of some attribute can be defining more times(according to ISO). This attributes must be defined in block of template with starting statements and ending mark of block. Allowed loop statement is FOR(see jinja2 manual). The XML based text of block will by duplicated according to number of items in the list.

Initialize of OWSLib objects

Most object are initialized in configure file which is stored in wx.metadat/config/init_md.txt example: Default configure file for the build-in Basic and Inspire profile:

self.md.identification = MD_DataIdentification() 
self.md.dataquality = DQ_DataQuality() 
self.md.distribution = MD_Distribution() 
self.md.identification.extent = EX_Extent() 
self.md.identification.extent.boundingBox = EX_GeographicBoundingBox()
  1. on the left side of equation is obligatory prefix 'self.md'. Postfix(name of variable) is open. On right side is OWSLib object

Single element

In case if the value of metadata element is declared once: example: Identifier

{{ md.identifier }}

example: Lineage

{{ md.dataquality.lineage }}

Loop or Condition statements

Loops or condition are defined in by starting braces {% -%} and ending braces Start of block:

example: for statement

{% for co in md.contact -%}

Editor allows to use Python 'zip' function and 'len' function. Note- in Jinja syntax is Python len(length) function defined specifically.

example: zip

{% for (u,d) in zip(md.identification.uom,md.identification.distance) -%}

example: len

{% if md.identification.denominators|length > 0 -%}

End of block is defined by: example: if statement

{% endif -%}

example: for statement

{% endfor -%}

The second braces

The second braces(by jinja syntax comment) contains these parameters: tag - just copy of string from first braces object – for reading and holding metada in python objects is used OWSLib library. Most of object are initialized in configuration file wx.metadata/config/init_md.txt. Some metadata attributes is necessary initialized directly by this parameter. Best example is the metadata contact object(organization,email) which can be initialized for more times.

example: responsible party

{% for co in md.contact -%}{# object="CI_ResponsibleParty()" #}
{{ co.organization }}{# object="CI_ResponsibleParty()" #}
{{ co.email }}{# object="CI_ResponsibleParty()" #}
{{ co.role }}{# object="CI_ResponsibleParty()" #}
{% endfor -%}
  • name – free text string describing the name of metadata item
  • ref – free additional information. By default should be reference of ISO attributes
  • type – data type characteristic. For 'email' and 'date' is implemented text field validator
  • desc – free text which should describe or define the characteriscic of metadata item
  • example – free text with example of the value for metadata item
  • group- label of the notebook list in editor.
  • inbox- label of the box which includes attributes from the block of jinja template. All items from one block of Jinja template must be in same box(same name).
  • multi- 0 or 1. In case 0, the item cannot be duplicated= text field widget not dispose with button for cloning self. Note that only OWSLib list based variables can be used with duplication button.
  • inboxmulti- 0 or 1. In case 0, the items in box cannot be duplicated = box with items not dispose with button for cloning self.
  • multiline – True = initialize text field with multilines editing. Suitable for longer texts input

example of second braces:

{# tag="md.dataquality.lineage" , name="Lineage" , ref= "Part B 6.1" ,/
 desc= "General explanation of the data producers knowledge about the lineage of a dataset."/
 ,example = "Product 1 scenes correspond to the path/row of the Landsat orbit.." ,/
 type ="string" , group= "Quality and Validity" ,  multiline= True #}

Syntax of Jinja template system and editor custom parser

  • both of braces of one metadata element must be on same line
  • after '{# ','{%' must be white space. Also before '#}' '-%}'


See also

development page