upp-x11-src  11873
About: Ultimate++ is a C++ cross-platform rapid application development framework. Stable release.
  Fossies Dox: upp-x11-src-11873.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

ISO8211Lib

Introduction

ISO8211Lib is intended to be a simple reader for ISO/IEC 8211 formatted files, particularly those that are part of SDTS and S-57 datasets. It consists of open source, easy to compile and integrate C++ code.

ISO 8211 Background

The ISO 8211 FAQ has some good background on ISO 8211 formatted files. I will briefly introduce it here, with reference to the library classes representing the components.

An 8211 file (DDFModule) consists of a series of logical records. The fiarst record is special, and is called the DDR (Data Description Record). It basically contains definitions of all the data objects (fields or DDFFieldDefn objects) that can occur on the following data records.

The remainder of the records are known as DRs (data records - DDFRecord). They each contain one or more field (DDFField) instances. What fields appear on what records is not defined by ISO 8211, though more specific requirements may be implied by a particular data standard such as SDTS or S-57.

Each field instance has a name, and consists of a series of subfields. A given field always has the same subfields in each field instance, and these subfields are defined in the DDR (DDFSubfieldDefn), in association with their field definition (DDFFieldDefn). A field may appear 0, 1, or many times in a DR.

Each subfield has a name, format (from the DDFSubfieldDefn) and actual subfield data for a particular DR.
Some fields contain an array of their group of subfields. For instance a coordinate field may have X and Y subfields, and they may repeat many times within one coordinate field indicating a series of points.

This would be a real good place for a UML diagram of ISO 8211, and the corresponding library classes!

Development Information

The iso8211.h contains the definitions for all public ISO8211Lib classes, enumerations and other services.

To establish access to an ISO 8211 dataset, instantiate a DDFModule object, and then use the DDFModule::Open() method. This will read the DDR, and establish all the DDFFieldDefn, and DDFSubfieldDefn objects which can be queried off the DDFModule.

The use DDFModule::ReadRecord() to fetch data records (DDFRecord). When a record is read, a list of field objects (DDFField) on that record are created. They can be queried with various DDFRecord methods.

Data pointers for individual subfields of a DDFField can be fetched with DDFField::GetSubfieldData(). The interpreted value can then be extracted with the appropriate one of DDFSubfieldDefn::ExtractIntValue(), DDFSubfieldDefn::ExtractStringValue(), or DDFSubfieldDefn::ExtractFloatValue(). Note that there is no object instantiated for individual subfields of a DDFField. Instead the application extracts a pointer to the subfields raw data, and then uses the DDFSubfieldDefn for that subfield to extract a useable value from the raw data.

Once the end of the file has been encountered (DDFModule::ReadRecord() returns NULL), the DDFModule should be deleted, which will close the file, and cleanup all records, definitions and related objects.

Class APIs

A complete Example Reader should clarify simple use of ISO8211Lib.

Related Information

  • The ISO 8211 standard can be ordered through ISO. It cost me about $200CDN.

  • The ISO/IEC 8211/DDFS Home Page contains tutorials and some code by Dr. Alfred A. Brooks, one of the originators of the 8211 standard.

  • The ISO/IEC 8211 Home Page has some python code for parsing 8211 files, and some other useful background.

  • The SDTS++ library from the USGS includes support for ISO 8211. It doesn't include some of the 1994 additions to ISO 8211, but it is sufficient for SDTS, and quite elegantly done. Also supports writing ISO 8211 files.

  • The USGS also has an older FIPS123 library which supports the older profile of ISO 8211 (to some extent).

Licensing

This library is offered as Open Source. In particular, it is offered under the X Consortium license which doesn't attempt to impose any copyleft, or credit requirements on users of the code.

The precise license text is:

Copyright (c) 1999, Frank Warmerdam

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Building the Source

  1. First, fetch the source. The most recent source should be accessable at an url such as http://home.gdal.org/projects/iso8211/iso8211lib-1.4.zip.

  2. Untar the source.

    % unzip iso8211lib-1.4.zip

  3. On unix you can now type `‘configure’' to establish configuration options.

  4. On unix you can now type make to build libiso8211.a, and the sample mainline 8211view.

Windows developers will have to create their own makefile/project but can base it on the very simple Makefile.in provided. As well, you would need to copy cpl_config.h.in to cpl_config.h, and modify as needed. The default will likely work OK, but may result in some compiler warnings.
Let me know if you are having difficulties, and I will prepare a VC++ makefile.

Author and Acknowledgements

The primary author of ISO8211Lib is Frank Warmerdam, and I can be reached at warmerdam@pobox.com. I am eager to receive bug reports, and also open to praise or suggestions.

I would like to thank:

  • Safe Software who funded development of this library, and agreed for it to be Open Source.

  • Mark Colletti, a primary author of SDTS++ from which I derived most of what I know about ISO 8211 and who was very supportive, answering a variety of questions.

  • Tony J Ibbs, author of the ISO/IEC 8211 home page who answered a number of questions, and collected a variety of very useful information.

  • Rodney Jenson, for a detailed bug report related to repeating variable length fields (from S-57).

I would also like to dedicate this library to the memory of Sol Katz.
Sol released a variety of SDTS (and hence ISO8211) translators, at substantial personal effort, to the GIS community along with the many other generous contributions he made to the community. His example has been an inspiration to me, and I hope similar efforts on my part will contribute to his memory.