The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Geo::EOP - Earth Observation Products EOP

INHERITANCE

 Geo::EOP
   is a Geo::GML
   is a XML::Compile::Cache
   is a XML::Compile::Schema
   is a XML::Compile

SYNOPSIS

 use Geo::EOP ':eop1.1';

 my $eop = Geo::EOP->new(eop_version => '1.1');

 # see XML::Compile::Cache on how to use readers and writers
 my $data = $eop->reader("gml:GridCoverage")->($xmlmsg);
 my $xml  = $eop->writer($sometype)->($doc, $perldata);

 # or without help of the cache, XML::Compile::Schema
 my $r    = $gml->compile(READER => $sometype);
 my $data = $r->($xml);

 # read a eop data file.  Autodetects the version used.
 my ($type, $data) = Geo::EOP->from('data.xml');
 print "Root type:   $type\n";
 print "EOP version: $data->{version}\n";

 # huge overview on all defined elements
 $gml->printIndex;

DESCRIPTION

Provides access to the EOP definitions specified as XML schemas, based on GML. Up to version 1.0, these schemas where named 'HMA' (Heterogeneous EO Missions Accessibility), and the development is still part of these ESA efforts for standardization.

BE WARNED that HMA1.0 and EOP 1.1/1.2 are only using a subset of GML version 3.1.1, due to problems with some software tools. This limitation will probably be removed in 1.3 (or whatever the next version will be named).

The first releases of this module will not powerful, but hopefully people contribute. For instance, an example conversion script between various versions is very welcome! It would be nice to help each other. I will clean-up the implementation, to make it publishable, but do not have the knowledge about needed to implement the converter itself.

METHODS

Constructors

Geo::EOP->from(XMLDATA, OPTIONS)

    Read a EOP structure from a data source, which can be anything acceptable by dataToXML(): a XML::LibXML::Element, XML as string or ref-string, filename, filehandle or known namespace.

    Returned is the product (the type of the root node) and the parsed data-structure. The EOP version used for decoding is autodetected, unless specified.

    See examples/read_eop.pl

    example:

      my ($type, $data) = Geo::EOP->from('data.xml');

Geo::EOP->new(OPTIONS)

     Option            --Defined in     --Default
     allow_undeclared    Geo::GML         <true>
     any_element         XML::Compile::Cache  ATTEMPT
     eop_version                          <required>
     hook                XML::Compile::Schema  undef
     hooks               XML::Compile::Schema  []
     ignore_unused_tags  XML::Compile::Schema  <false>
     key_rewrite         XML::Compile::Schema  []
     opts_readers        XML::Compile::Cache  []
     opts_rw             XML::Compile::Cache  <some>
     opts_writers        XML::Compile::Cache  []
     prefixes            Geo::GML         undef
     schema_dirs         XML::Compile     undef
     typemap             XML::Compile::Schema  {}
     units                                <none>
     version             Geo::GML         <required>

    . allow_undeclared => BOOLEAN

    . any_element => CODE|'TAKE_ALL'|'SKIP_ALL'|'ATTEMPT'

    . eop_version => VERSION|NAMESPACE

      Only used when the object is created directly from this base-class. It determines which EOP syntax is to be used. Can be a VERSION like "1.1" or a NAMESPACE URI like 'NS_EOP_11'.

    . hook => ARRAY-WITH-HOOKDATA | HOOK

    . hooks => ARRAY-OF-HOOK

    . ignore_unused_tags => BOOLEAN|REGEXP

    . key_rewrite => HASH|CODE|ARRAY-of-HASH-and-CODE

    . opts_readers => HASH|ARRAY-of-PAIRS

    . opts_rw => HASH|ARRAY-of-PAIRS

    . opts_writers => HASH|ARRAY-of-PAIRS

    . prefixes => ARRAY|HASH

    . schema_dirs => DIRECTORY|ARRAY-OF-DIRECTORIES

    . typemap => HASH

    . units => HASH

      See "Units". Only if you specify your preference in units of measurement, some automatic translations will be performed.

    . version => VERSION|NAMESPACE

Accessors

$obj->addHook(HOOKDATA|HOOK|undef)

$obj->addHooks(HOOK, [HOOK, ...])

$obj->addKeyRewrite(CODE|HASH, CODE|HASH, ...)

$obj->addSchemaDirs(DIRECTORIES|FILENAME)

Geo::EOP->addSchemaDirs(DIRECTORIES|FILENAME)

$obj->addSchemas(XML, OPTIONS)

$obj->addTypemap(PAIR)

$obj->addTypemaps(PAIRS)

$obj->allowUndeclared([BOOLEAN])

$obj->direction

$obj->eopVersion

    EOP/HMA version, for instance '1.0'.

$obj->hooks

$obj->prefix(PREFIX)

$obj->prefixFor(URI)

$obj->prefixes([PAIRS|ARRAY|HASH])

$obj->useSchema(SCHEMA, [SCHEMA])

$obj->version

Compilers

$obj->compile(('READER'|'WRITER'), TYPE, OPTIONS)

$obj->compileAll(['READER'|'WRITER'|'RW', [NAMESPACE]])

Geo::EOP->dataToXML(NODE|REF-XML-STRING|XML-STRING|FILENAME|FILEHANDLE|KNOWN)

$obj->reader(TYPE|NAME, OPTIONS)

$obj->template('PERL'|'XML', TYPE, OPTIONS)

$obj->writer(TYPE|NAME)

Helpers

$obj->GPtoGML(OBJECT, OPTIONS)

Administration

$obj->declare('READER'|'WRITER'|'RW', TYPE|ARRAY-of-TYPES, OPTIONS)

$obj->elements

$obj->findName(NAME)

$obj->findSchemaFile(FILENAME)

Geo::EOP->findSchemaFile(FILENAME)

$obj->importDefinitions(XMLDATA, OPTIONS)

$obj->knownNamespace(NAMESPACE|PAIRS)

Geo::EOP->knownNamespace(NAMESPACE|PAIRS)

$obj->namespaces

$obj->printIndex([FILEHANDLE], OPTIONS)

    List all the elements which can be produced with the schema. By default, this only shows the elements and excludes the abstract elements from the list. The selected FILEHANDLE is the default to print to.

     Option       --Defined in         --Default
     show_declared  XML::Compile::Cache  <true>

    . show_declared => BOOLEAN

$obj->types

$obj->walkTree(NODE, CODE)

DETAILS

Units

GML is careful about its units, which is nice but verbose. Therefore, this module gives you a way to set your preferences. The reader will simplify the structure, re-calculating the values found into the units of measure you prefer, according to UCUM (http://aurora.regenstrief.org/ucum)

  my $eop = Geo::EOP->new(...
     , units => { distance => 'm'
                , angle    => 'deg' }
     );

Available conversions:

angle 'deg'|'rad'

Will be applied to all AngleType elements

distance 'm'

Will be applied to all MeasureType elements

percentage '%'|'float'

Will be applied to all elements with a name ending on "Percentage". I am not sure about the float... cannot find the uom name.

DIAGNOSTICS

Error: cannot find pre-installed name-space files

    Use $ENV{SCHEMA_LOCATION} or new(schema_dirs) to express location of installed name-space files, which came with the XML::Compile distribution package.

Error: don't known how to interpret XML data

SEE ALSO

This module is part of Geo-EOP distribution version 0.13, built on January 29, 2009. Website: http://perl.overmeer.net/geo/ All modules in this suite: "Geo::GML", "Geo::ISO19139", "Geo::EOP", "Geo::Point", "Geo::Proj4", "Geo::WKT", and "Math::Polygon".

Please post questions or ideas to http://geo-perl@list.hut.fi|the Geo-Perl mailinglist

COPYRIGHTS

License of the CODE

Copyrights of the perl code and the related documentation by 2008-2009 by Mark Overmeer. For other contributors see ChangeLog.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://www.perl.com/perl/misc/Artistic.html

License of the SCHEMAS

The included schemas are copyrighted by the Open Geospatial Consortium, Inc. They are unmodified copied from the files at http://schemas.opengis.net. Read OGCs disclaimer and copyright statements on documentation and software at http://www.opengeospatial.org/ogc/legal. The license text is also included in this CPAN distribution.