Class CoordinateOperationContext

  • All Implemented Interfaces:
    Serializable

    public class CoordinateOperationContext
    extends Object
    implements Serializable
    Optional information about the context in which a requested coordinate operation will be used. The context can provide information such as:
    • The geographic area where the transformation will be used.
    • The desired accuracy. A coarser accuracy may allow SIS to choose a faster transformation method.
    While optional, those information can help Default­Coordinate­Operation­Factory to choose the most suitable coordinate transformation between two CRS.
    Example: if a transformation from NAD27 to WGS84 is requested without providing context, then Apache SIS will return the transformation applicable to the widest North American surface. But if the user provides a context saying that he wants to transform coordinates in Texas, then Apache SIS may return another coordinate transformation with different Bursa-Wolf parameters more suitable to Texas, but not suitable to the rest of North-America.
    Coordinate­Operation­Context is part of the API used by SIS for implementing the late binding model. See package javadoc for a note on early binding versus late binding implementations.
    Since:
    0.7
    See Also:
    Serialized Form

    Defined in the sis-referencing module

    TODO:
    Should also take the country of a Locale. The EPSG database contains ISO2 and ISO3 identifiers that we can use.
    • Constructor Detail

      • CoordinateOperationContext

        public CoordinateOperationContext()
        Creates a new context with no area of interest and the best accuracy available.
      • CoordinateOperationContext

        public CoordinateOperationContext​(Extent area,
                                          double accuracy)
        Creates a new context with the given area of interest and desired accuracy.
        Parameters:
        area - the area of interest, or null if none.
        accuracy - the desired accuracy in metres, or 0 for the best accuracy available. See get­Desired­Accuracy() for more details about what we mean by "best accuracy".
    • Method Detail

      • fromBoundingBox

        public static CoordinateOperationContext fromBoundingBox​(GeographicBoundingBox areaOfInterest)
        Creates an operation context for the given area of interest, which may be null or undefined. This is a convenience method for a frequently-used operation.
        Parameters:
        area­Of­Interest - the area of interest, or null if none.
        Returns:
        the operation context, or null if the given bounding box was null, undefined or covers the whole world (in which case Apache SIS does not need that we specify a context).
        Since:
        1.0
      • setAreaOfInterest

        public void setAreaOfInterest​(Extent area)
        Sets the spatiotemporal area of interest, or null if none.
        Parameters:
        area - the spatiotemporal area of interest, or null if none.
      • getDesiredAccuracy

        public double getDesiredAccuracy()
        Returns the desired accuracy in metres. A value of 0 means to search for the most accurate operation.

        When searching for the most accurate operation, SIS considers only the operations specified by the authority. For example the Molodensky method is a better datum shift approximation than Abridged Molodensky. But if all coordinate operations defined by the authority use the Abridged Molodensky method, then SIS will ignore the Molodensky one.

        Returns:
        the desired accuracy in metres.
      • setDesiredAccuracy

        public void setDesiredAccuracy​(double accuracy)
        Sets the desired accuracy in metres. A value of 0 means to search for the most accurate operation. See get­Desired­Accuracy() for more details about what we mean by "most accurate".
        Parameters:
        accuracy - the desired accuracy in metres.