Class TransformationUtil

java.lang.Object
org.tailormap.api.geotools.TransformationUtil

public class TransformationUtil extends Object
  • Method Summary

    Modifier and Type
    Method
    Description
    static @Nullable org.geotools.api.referencing.operation.MathTransform
    getTransformationToApplication(@NonNull Application application, @NonNull org.geotools.api.data.SimpleFeatureSource simpleFeatureSource)
    Determine whether we need to transform geometries to the application CRS.
    static @Nullable org.geotools.api.referencing.operation.MathTransform
    getTransformationToDataSource(@NonNull Application application, @NonNull org.geotools.api.data.SimpleFeatureSource simpleFeatureSource)
    Determine whether we need to transform geometry to data source crs.
    static org.geotools.api.filter.Filter
    transformFilterGeometries(@NonNull org.geotools.api.filter.Filter filter, @Nullable org.geotools.api.referencing.operation.MathTransform transform)
    Transforms the geometries in the given (intersects) spatial filter using the specified transformation.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getTransformationToApplication

      public static @Nullable org.geotools.api.referencing.operation.MathTransform getTransformationToApplication(@NonNull Application application, @NonNull org.geotools.api.data.SimpleFeatureSource simpleFeatureSource) throws org.geotools.api.referencing.FactoryException
      Determine whether we need to transform geometries to the application CRS. Note that this uses the "default geometry" attribute of the feature source, in cases where a feature source has multiple geometry attributes (with possibly different CRSs) or heterogenous CRSs across a single geometry attribute this may not be accurate.
      Parameters:
      application - the referenced application
      simpleFeatureSource - the feature source used in the application
      Returns:
      null when no transform is required and a valid transform otherwise
      Throws:
      org.geotools.api.referencing.FactoryException - when the CRS cannot be decoded
    • getTransformationToDataSource

      public static @Nullable org.geotools.api.referencing.operation.MathTransform getTransformationToDataSource(@NonNull Application application, @NonNull org.geotools.api.data.SimpleFeatureSource simpleFeatureSource) throws org.geotools.api.referencing.FactoryException
      Determine whether we need to transform geometry to data source crs. Note that this uses the "default geometry" attribute of the feature source, in cases where a feature source has multiple geometry attributes (with possibly different CRSs) or heterogeneous CRSs across a single geometry attribute this may not be accurate.
      Parameters:
      application - the referenced application
      simpleFeatureSource - the feature source used in the application
      Returns:
      null when no transform is required and a valid transform otherwise
      Throws:
      org.geotools.api.referencing.FactoryException - when the CRS cannot be decoded
    • transformFilterGeometries

      public static org.geotools.api.filter.Filter transformFilterGeometries(@NonNull org.geotools.api.filter.Filter filter, @Nullable org.geotools.api.referencing.operation.MathTransform transform)
      Transforms the geometries in the given (intersects) spatial filter using the specified transformation.
      Parameters:
      filter - the spatial filter, currently only intersects filters are supported
      transform - the transformation to apply
      Returns:
      the transformed filter