IBM® Informix® 12.10

The CoordRefManager Class

The CoordRefManager class provides methods that create and handle CoordRef objects, which hold definitions of spatial reference systems.

A CoordRef object represents a coordinate reference that defines a spatial reference system. This includes the coordinate system plus a set of offset and scale values that convert floating point real-world values into integers for compatibility with the ESRI SDE layer.

A CoordRefManager object is usually associated with a particular database that contains spatial data. In this database, the spatial_references table stores data about each map projection that you use to store the spherical geometry of the Earth. This data enables the spatial extension to translate the data into a flat, X-Y coordinate system.

The spatial reference ID (SRID) is the unique key for records in the spatial_references table. All spatial reference systems that are used in this database must have a record in the spatial_references table. Also, all geometries in a spatial column must use the same spatial reference system.

A CoordRefManager object can retrieve a spatial reference system from the database using the SRID. CoordRefManager can also create and store user-defined spatial reference systems in the database.

CoordRefManager creates a local cache of objects that are in use, that is, CoordRef objects that are referenced by existing geometry instances. The following methods operate with this cache:
  • get(int) Reads a coordinate reference with the given SRID into the cache and returns it to the user

    This is the only method that should be used by geometry factories when associating new geometries to a coordinate reference.

  • put(CoordRef) Saves a given CoordRef object in the cache and writes it into the database
  • getAll(), getAllSrids() Return all the elements that are stored in the cache
  • refresh() If other database clients directly modify the spatial_references table, the database and the cache may get out of synchronization. This method refreshes elements that are in the inuse cache with data from the underlying database.
  • remove(), removeFromCache() Remove a CoordRef object from both the cache and database, or only from the cache. CoordRef objects must not be removed from the cache unless there are no geometries associated with them.
  • findXXX() Query the database directly for coordinate references that are not in use (for example, to list all the coordinate references with a specified authoritative name and ID).

    The enumerations returned by the findXXX() methods are not failsafe in the sense iterators are when used by the java.util package. The enumerations contain a snapshot of the CoordRefManager object and the database at the moment the findXXX() method is called and do not reflect later changes in the cache or database.

CoordRefManager is safe for concurrent access by multiple threads.
Important: You must ensure that the local cache stays synchronized with the underlying database; for example, do not directly delete rows from the spatial_references table.


Examples exchange | Troubleshooting

To find the PDF, see Publications for the IBM Informix 12.10 family of products.
For the release notes, documentation notes, and/or machine notes, see the Release Notes page.