opengeospatial / geotiff

18 stars 9 forks source link

Clarify usage and registration of new taggs for future extensions #111

Open ghobona opened 1 year ago

ghobona commented 1 year ago

The OGC-NA maintains a register of GeoTIFF tags.

In the future it may be necessary for communities that use COG to register tags for their specialist use cases.

Such tags could then be organised into groups that deal with the needs of a particular domain.

See this OWS-9 engineering report for some examples of metadata for specialist use cases.

So the COG spec could include a mention of the GeoTIFF Tag Register.

geospatial-jeff commented 1 year ago

In the future it may be necessary for communities that use COG to register tags for their specialist use cases.

TIFF v6 supports adding custom tags which allow users to implement their own TIFF tags for specific use cases (see the bottom of page 8). Tags numbered 32768 or higher are reserved for public/custom tags while 65000-65535 are reserved for private/custom tags.

For example, GDAL implements several of its own custom/public tags in the 32768-64999 range.

Such tags could then be organised into groups that deal with the needs of a particular domain.

Grouping multiple custom tags into a particular domain is done through a custom tiff tag whose value is either a byte offset to a private IFD containing the private keys within that domain or whose value is the private keys themselves. The GeoKeyDirectoryTag from the geotiff specification is a good example of this. From http://geotiff.maptools.org/spec/geotiff2.4.html:

The number and type of parameters that would be required to describe most popular projection types would, if implemented as separate TIFF tags, likely require dozens or even hundred of tags, exhausting the limited resources of the TIFF tag-space. On the other hand, a private IFD, while providing thousands of free tags, is limited in that its tag-values are invisible to non-savvy TIFF readers (which don't know that the IFD_OFFSET tag value points to a private IFD).

To avoid these problems, a GeoTIFF file stores projection parameters in a set of "Keys" which are virtually identical in function to a "Tag", but has one more level of abstraction above TIFF. Effectively, it is a sort of "Meta-Tag". A Key works with formatted tag-values of a TIFF file the way that a TIFF file deals with the raw bytes of a data file. Like a tag, a Key has an ID number ranging from 0 to 65535, but unlike TIFF tags, all key ID's are available for use in GeoTIFF parameter definitions.

I don't think the COG spec should define how to implement custom tags/domains, as it is clearly described in the TIFF spec and there are reference examples in the geotiff spec. But maybe the COG spec could direct readers to these resources.

joanma747 commented 1 year ago

We seem to agree that this issue does not affect COG and should be transferred to the GeoTIFF work space

joanma747 commented 1 year ago

I agree in principle but I also have may objections. The "GeoTIFF tags" are defined in the GeoTIFF standard and IMHO cannot be extended without editing the standard. What is possible for the communities is to define new "TIFF tags" outside the GeoTIFF specification . But, defining TIFF tags is complicated as there is no common registry for that (extraofficial one here: https://www.awaresystems.be/imaging/tiff/tifftags.html). An alternative for communities could be to define new GeoTIFF keys inside the current GeoTIFF tags by extending GeoTIFF standard to other domains. This means that we might need a registry of GeoTIFF keys too that is extensible. Do we have a registry for geotiff keys?.

For the moment I have added the following text to the standard: "The OGC-NA maintains a register of TIFF tags relevant for the geospatial community (most of them defined in the GeoTIFF standard) with the URL http://www.opengis.net/def/geotiff-tag. The COG standard does neither defines COG specific TIFF tags nor GeoTIFF keys. In the future it may be necessary for the communities that use COG to register tags for their specialist use cases. It is also possible that they reuse the existing GeoTIFF tags to define new GeoTIFF keys. Such tags or keys could then be organized into groups that deal with the needs of a particular domain."