Class WorldFileStore

All Implemented Interfaces:
AutoCloseable, ResourceOnFileSystem, StoreResource, Resource, Localized

public class WorldFileStore extends PRJDataStore
A data store which creates grid coverages from Image I/O readers using World File convention. Georeferencing is defined by two auxiliary files having the same name than the image file but different suffixes:
  • A text file containing the coefficients of the affine transform mapping pixel coordinates to geodesic coordinates. The reader expects one coefficient per line, in the same order than the order expected by the AffineTransform(double[]) constructor, which is scaleX, shearY, shearX, scaleY, translateX, translateY. The reader looks for a file having the following suffixes, in preference order:
    1. The first letter of the image file extension, followed by the last letter of the image file extension, followed by 'w'. Example: "tfw" for "tiff" images, and "jgw" for "jpeg" images.
    2. The extension of the image file with a 'w' appended.
    3. The "wld" extension.
  • A text file containing the Coordinate Reference System (CRS) definition in Well Known Text (WKT) syntax. The reader looks for a file having the ".prj" extension.
Every auxiliary text file are expected to be encoded in UTF-8 and every numbers are expected to be formatted in US locale.

Type of input objects

The StorageConnector input should be an instance of the following types: Path, File, URL or URI. Other types such as ImageInputStream are also accepted but in those cases the auxiliary files cannot be read. For any input of unknown type, this data store first checks if an ImageReader accepts the input type directly. If none is found, this data store tries to create an input stream from the input object.

The storage input object may also be an ImageReader instance ready for use (i.e. with its input set to a non-null value). In that case, this data store will use the given image reader as-is. The image reader will be disposed and its input closed (if AutoCloseable) when this data store is closed.

Handling of multi-image files

Because some image formats can store an arbitrary number of images, this data store is considered as an aggregate with one resource per image. All image should have the same size and all resources will share the same GridGeometry. However, this base class does not implement the Aggregate interface directly in order to give a chance to subclasses to implement GridCoverageResource directly when the format is known to support only one image per file.
Since:
1.2
Version:
1.3
Author:
Martin Desruisseaux (Geomatys)