Skip to content

Consider GeoAPI for referencing and metadata aspects of new UCAR API #256

@desruisseaux

Description

@desruisseaux

Following on the NetCDF-Java - Looking Ahead blog, I propose to use GeoAPI for referencing by coordinates aspects (map projections) and possibly some metadata. Note that I'm not proposing to adopt any particular implementation — GeoAPI is only a set of Java interfaces, implementation can stay the UCAR one. This is an approach similar to JDBC for databases. GeoAPI can be at the hearth of UCAR new API or can be kept isolated as wrappers in a separated module, at your choice.

What is GeoAPI

GeoAPI 3.0.1 is an adopted Open Geospatial Consortium (OGC) standard. It takes the UML models of the following standards and translate them into Java interfaces:

  • ISO 19103 — Conceptual schema language
  • ISO 19115 — Metadata
  • ISO 19111 — Spatial Referencing by Coordinates

For example map projection can be represented by an instance of ProjectedCRS. This interface provides methods for querying the datum, the axis units, their directions, etc. All those properties are defined in ISO 19111, which has been carefully designed by geodesic experts.

Using GeoAPI would add the following weight to the library:

  • GeoAPI 3.0.1 JAR file: 212 kb.
  • JSR-363 (unit of measurement) JAR file: 28 kb.

Benefits

A first benefit of using GeoAPI is to inherit knowledge from the ISO 19111 expert group. Projects designing their own API are at risk of missing important aspects if an accuracy better than a few meters is desired. Referencing by coordinates is both crucial to geospatial libraries and very often an underestimated challenge. Even the popular PROJ.4 library had significant design flaws (fixed in PROJ.6 by adopting the ISO 19111 conceptual model completed by inspiration from GeoAPI).

A second benefit is to give the possibility to plugin alternative implementations if desired. Existing implementations include JNI wrappers around the PROJ.6 library and Apache Spatial Information System (pure Java). If the netCDF library uses CoordinateReferenceSystem interface and CoordinateOperation for transforming coordinates, then the library can perform map projections using its own internal implementation, or using Apache SIS, PROJ.6 or other implementations at user choice and transparently.

A third benefit is that it can enable new services. For example it is possible to use Apache SIS Well Known Text (WKT) parser for reading a coordinate reference system definition and instantiating UCAR map projection objects (not necessarily SIS objects) from that WKT.

Another benefit is that if netCDF, PROJ.6 and Apache SIS API are derived from the same conceptual model (ISO 19111), then the similarities make easier for a developer familiar with one library to master the "referencing by coordinates" aspect of the other library.

Inconvenient

Less control from UCAR on that API (but GeoAPI development is open and any interested OGC members have equal vote). However it is always possible to define custom extensions in implementation classes.

Implementation strategy

Two approaches are possible. The first one is to use GeoAPI interfaces everywhere netCDF API needs to represent a coordinate reference system or a coordinate operation.

  • Advantage: allow to plugin directly an alternative implementation when desired. More than one implementation can coexist in the same JVM.
  • Inconvenient: GeoAPI dependency become mandatory (the JAR file is 212 kb).

A second approach is to keep the core of netCDF library independent of GeoAPI and implement GeoAPI interfaces as wrappers around UCAR netCDF in a separated module.

  • Advantage: more flexibility about whether or not using GeoAPI and which version.
  • Inconvenient: the capability to plugin alternative implementations into netCDF library (for example for using some PROJ.6 map projections not yet provided by netCDF library) is reduced or more difficult.

Existing material

Wrappers already exist as a demonstration project. I would be happy to donate that code if desired; it could be used as a starting point. I can also volunteer for contributing to the work of introducing GeoAPI in the netCDF library if desired, and proposing maintenance when GeoAPI is updated to a new version.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions